package com.example.choupaiapp.main.activity.message;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v4.widget.NestedScrollView;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.method.MovementMethod;
import android.text.style.DynamicDrawableSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.view.View;
import android.view.ViewParent;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.dueeeke.videocontroller.StandardVideoController;
import com.dueeeke.videoplayer.player.VideoView;
import com.example.choupaiapp.R;
import com.example.choupaiapp.common.adapter.BaseAdapterHelper;
import com.example.choupaiapp.common.adapter.QuickAdapter;
import com.example.choupaiapp.common.constant.Contacts;
import com.example.choupaiapp.common.finalokgo.callback.Callback;
import com.example.choupaiapp.common.finalokgo.request.RequestType;
import com.example.choupaiapp.common.ui.activity.CommonActivity;
import com.example.choupaiapp.common.util.ContextUtil;
import com.example.choupaiapp.common.util.DateFormatUtil;
import com.example.choupaiapp.common.util.DialogUtil;
import com.example.choupaiapp.common.util.GsonUtil;
import com.example.choupaiapp.common.util.SharedPreferencesHelp;
import com.example.choupaiapp.common.util.Utils;
import com.example.choupaiapp.common.view.XListView;
import com.example.choupaiapp.main.activity.home.CommentDetailActivity;
import com.example.choupaiapp.main.activity.home.OtherInfoActivity;
import com.example.choupaiapp.main.activity.home.VideoDetailActivity;
import com.example.choupaiapp.main.activity.mine.ReportActivity;
import com.example.choupaiapp.main.bean.CommentListBean;
import com.example.choupaiapp.main.bean.CommentRemindJsonBean;
import com.example.choupaiapp.main.bean.ContentDetailBean;
import com.example.choupaiapp.main.bean.ContentVoteListBean;
import com.example.choupaiapp.main.bean.InvitationBean;
import com.example.choupaiapp.main.bean.RemindJson;
import com.example.choupaiapp.main.bean.SendCodeBean;
import com.example.choupaiapp.main.bean.ShareDataBean;
import com.example.choupaiapp.main.bean.UserInfoBean;
import com.example.choupaiapp.main.bean.VideoListBean;
import com.example.choupaiapp.main.callback.WechatCallBack;
import com.example.choupaiapp.main.constant.Config;
import com.example.choupaiapp.main.constant.Url;
import com.example.choupaiapp.main.util.DetailCommentDialog;
import com.example.choupaiapp.main.util.DialogFragmentDataCallback;
import com.example.choupaiapp.main.util.LocationUtil;
import com.example.choupaiapp.main.util.WXShareUtil;
import com.example.choupaiapp.main.util.WechatLoginUtil;
import com.example.choupaiapp.main.util.video.PreloadManager;
import com.example.choupaiapp.main.util.video.VideoPraiseHashMap;
import com.example.choupaiapp.main.view.MyNineGridView;
import com.example.choupaiapp.main.view.MyNineGridViewAdapter;
import com.example.choupaiapp.main.view.video.ScaleFrameLayout;
import com.lzy.ninegrid.ImageInfo;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.orhanobut.logger.Logger;
import com.scwang.smartrefresh.header.MaterialHeader;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.shuyu.textutillib.RichTextView;
import com.shuyu.textutillib.SmileUtils;
import com.shuyu.textutillib.TextCommonUtils;
import com.shuyu.textutillib.listener.ITextViewShow;
import com.shuyu.textutillib.listener.SpanAtUserCallBack;
import com.shuyu.textutillib.listener.SpanTopicCallBack;
import com.shuyu.textutillib.listener.SpanUrlCallBack;
import com.shuyu.textutillib.model.TopicModel;
import com.shuyu.textutillib.model.UserModel;
import com.shuyu.textutillib.span.ClickAtUserSpan;
import com.shuyu.textutillib.span.ClickTopicSpan;
import com.shuyu.textutillib.span.LinkSpan;
import com.sina.weibo.sdk.WbSdk;
import com.sina.weibo.sdk.api.TextObject;
import com.sina.weibo.sdk.api.WeiboMultiMessage;
import com.sina.weibo.sdk.auth.AuthInfo;
import com.sina.weibo.sdk.share.WbShareCallback;
import com.sina.weibo.sdk.share.WbShareHandler;
import com.tencent.connect.share.QQShare;
import com.tencent.connect.share.QzoneShare;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.Tencent;
import com.tencent.tauth.UiError;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by ASUS on 2019/12/12.
 */

public class ByIdDetailActivity extends CommonActivity implements OnRefreshLoadMoreListener, WbShareCallback, WechatCallBack, DialogFragmentDataCallback {

    private String id;
    private UserInfoBean mUserInfoBean;
    private int pageNum = 1;
    private int pageSize = 10;
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.head_photo_top)
    CircleImageView headPhotoTop;
    @BindView(R.id.top_name)
    TextView topName;
    @BindView(R.id.top_title)
    LinearLayout topTitle;
    @BindView(R.id.head_photo)
    CircleImageView headPhoto;
    @BindView(R.id.name)
    TextView name;
    @BindView(R.id.time)
    TextView time;
    @BindView(R.id.nineGrid)
    MyNineGridView nineGrid;
    @BindView(R.id.praise_iv)
    ImageView praiseIv;
    @BindView(R.id.praise_num)
    TextView praiseNum;
    @BindView(R.id.comment_iv)
    ImageView commentIv;
    @BindView(R.id.comment_num)
    TextView commentNum;
    @BindView(R.id.comment_count)
    TextView comment_count;
    @BindView(R.id.watch_num)
    TextView watch_num;
    @BindView(R.id.share_iv)
    ImageView shareIv;
    @BindView(R.id.share_num)
    TextView shareNum;
    @BindView(R.id.comment_listview)
    XListView commentListview;
    @BindView(R.id.follow)
    TextView follow;
    @BindView(R.id.scrollView)
    NestedScrollView scrollView;
    @BindView(R.id.new_title_bar)
    RelativeLayout new_title_bar;
    @BindView(R.id.container1)
    ScaleFrameLayout container1;
    @BindView(R.id.container2)
    ScaleFrameLayout container2;
    @BindView(R.id.content)
    RichTextView content;
    @BindView(R.id.location)
    TextView location;
    @BindView(R.id.comment_rl)
    RelativeLayout comment_rl;
    @BindView(R.id.comment_et)
    RichTextView comment_et;
    @BindView(R.id.refreshLayout)
    SmartRefreshLayout refreshLayout;
    @BindView(R.id.image)
    CircleImageView image;
    @BindView(R.id.empty_rl)
    RelativeLayout empty_rl;
    @BindView(R.id.vote_num_listview)
    XListView vote_num_listview;
    @BindView(R.id.invitation_status_ll)
    LinearLayout invitation_status_ll;
    //    @BindView(R.id.invitation_status)
//    TextView invitation_status;
    @BindView(R.id.tab1)
    TextView tab1;
    @BindView(R.id.tab2)
    TextView tab2;
    @BindView(R.id.award_ll)
    LinearLayout award_ll;
    @BindView(R.id.award_tv)
    TextView award_tv;
    @BindView(R.id.relative)
    RelativeLayout relative;
    private QuickAdapter<InvitationBean> invitation_adapter;
    @BindView(R.id.invitation_status)
    XListView invitation_status;
    private QuickAdapter<CommentListBean.PageBean.ListBean> quickAdapter;
    private String et_flag = "comment";
    private String replyUserId;
    private String replyCommentId;
    private Drawable drawable_select;
    private Drawable drawable_unselect;
    private Tencent mTencent;
    StyleSpan span = new StyleSpan(Typeface.BOLD);
    StyleSpan span2 = new StyleSpan(Typeface.BOLD);
    StyleSpan span1 = new StyleSpan(Typeface.NORMAL);
    StyleSpan span3 = new StyleSpan(Typeface.NORMAL);
    private ContentDetailBean mContentDetailBean;
    private VideoView videoView;
    private PreloadManager mPreloadManager;
    private StandardVideoController standardVideoController;
    private WbShareHandler shareHandler;
    private DetailCommentDialog commentDialogFragment;
    @BindView(R.id.praise)
    LinearLayout praise;
    private String replayName = "";
    private String replayContent = "";
    private List<UserModel> nameList;
    ForegroundColorSpan color1 = new ForegroundColorSpan(Color.parseColor("#666666"));
    ForegroundColorSpan color2 = new ForegroundColorSpan(Color.parseColor("#999999"));
    private SpannableString distace_sb;
    DecimalFormat df = new DecimalFormat("##.#");//输出"0.12"
    ITextViewShow iTextViewShow = new ITextViewShow() {
        @Override
        public void setText(CharSequence charSequence) {
            content.setText(charSequence);
        }

        @Override
        public CharSequence getText() {
            return content.getText();
        }

        @Override
        public void setMovementMethod(MovementMethod movementMethod) {
            content.setMovementMethod(movementMethod);
        }

        @Override
        public void setAutoLinkMask(int flag) {
            content.setAutoLinkMask(flag);
        }


        @Override
        public ClickAtUserSpan getCustomClickAtUserSpan(Context context, UserModel userModel, int color, SpanAtUserCallBack spanClickCallBack) {
            return null;
        }

        @Override
        public ClickTopicSpan getCustomClickTopicSpan(Context context, TopicModel topicModel, int color, SpanTopicCallBack spanTopicCallBack) {
            return null;
        }

        @Override
        public LinkSpan getCustomLinkSpan(Context context, String url, int color, SpanUrlCallBack spanUrlCallBack) {
            return null;
        }

        @Override
        public int emojiSize() {
            return 0;
        }

        @Override
        public int verticalAlignment() {
            return DynamicDrawableSpan.ALIGN_BOTTOM;
        }
    };

    SpanAtUserCallBack spanAtUserCallBack = new SpanAtUserCallBack() {
        @Override
        public void onClick(View view, UserModel userModel1) {
            Bundle bundle = new Bundle();
            bundle.putString("userId", userModel1.getUser_id());
            bundle.putString("userName", userModel1.getUser_name());
            startActivity(OtherInfoActivity.class, bundle);
            if (view instanceof TextView) {
                ((TextView) view).setHighlightColor(Color.TRANSPARENT);
            }
        }
    };
    private QuickAdapter<ContentVoteListBean> voteAdapter;
    private int replyPosition;
    private String flag = "";
    private boolean isFirst = false;

    /**
     * 处理自己的表情
     */
    private void initEmoji() {
        List<Integer> data = new ArrayList<>();
        List<String> strings = new ArrayList<>();
        int resofficial = getResources().getIdentifier("icon_comment_official", "mipmap", getPackageName());
        int resgod = getResources().getIdentifier("icon_comment_god", "mipmap", getPackageName());
        data.add(resofficial);
        strings.add("[icon_comment_official]");
        data.add(resgod);
        strings.add("[icon_comment_god]");
        /**初始化为自己的**/
        SmileUtils.addPatternAll(SmileUtils.getEmoticons(), strings, data);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_invitation_detail);
    }

    /**
     * 将播放器从父控件中移除
     */
    private void removePlayerFormParent(VideoView mVideoView) {
        ViewParent parent = mVideoView.getParent();
        if (parent instanceof FrameLayout) {
            ((FrameLayout) parent).removeView(mVideoView);
        }
    }


    private void tokenVerify() {
        HttpParams params = new HttpParams();
        params.put("token", (String) SharedPreferencesHelp.get("token", ""));
        finalOkGo.requestHead(RequestType.POSTHEAD, Url.VERIFY_TOKEN, params, Url.VERIFY_TOKEN, new Callback<SendCodeBean>() {
            @Override
            public void onSuccess(SendCodeBean sendCodeBean) {
                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                    commentDialogFragment = new DetailCommentDialog();
                    commentDialogFragment.setCommentFlag("ByIdDetailActivity");
                    commentDialogFragment.show(getFragmentManager(), "DetailCommentDialog");
                }
            }

            @Override
            public void onError(Response response) {
                super.onError(response);
            }
        });
    }

    @Override
    protected void initView() {
        mUserInfoBean = (UserInfoBean) SharedPreferencesHelp.getBean("userInfo");

        initEmoji();

        if (mUserInfoBean != null) {
            Glide.with(context)
                    .load(mUserInfoBean.getUser().getAvatar() + Config.IMAGE_LIM)
                    .error(R.mipmap.icon_no_head)
                    .into(image);
        } else {
            Glide.with(context)
                    .load(R.mipmap.icon_no_head)
                    .error(R.mipmap.icon_no_head)
                    .into(image);
        }

        nameList = new ArrayList<>();
        //直接使用RichTextView
        comment_et.setAtColor(Color.parseColor(getString(R.string.remind_color)));
        comment_et.setLinkColor(Color.BLUE);
        //所有配置完成后才设置text
        comment_et.setNameList(nameList);

        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            id = bundle.getString("id");
            flag = bundle.getString("flag");
        }

        drawable_select = getResources().getDrawable(R.mipmap.icon_praise_select);
        drawable_unselect = getResources().getDrawable(R.mipmap.item_praise);

        EventBus.getDefault().register(this);

        mPreloadManager = PreloadManager.getInstance(context);

        refreshLayout.setOnRefreshLoadMoreListener(this);
        refreshLayout.setRefreshHeader(new MaterialHeader(context).setColorSchemeResources(R.color.common_color));
        refreshLayout.setEnableAutoLoadMore(true);


        scrollView.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (nestedScrollView, x, y, i2, i3) -> {
            if (y <= 0) {
                title.setTextColor(getResources().getColor(R.color.color_333));
                topTitle.setVisibility(View.INVISIBLE);
            } else if (y > 0 && y >= new_title_bar.getHeight() / 3 * 2) {
                title.setTextColor(getResources().getColor(R.color.white));
                topTitle.setVisibility(View.VISIBLE);
            }
        });


        quickAdapter = new QuickAdapter<CommentListBean.PageBean.ListBean>(context, R.layout.item_comment_receive) {
            @Override
            protected void convert(BaseAdapterHelper helper, CommentListBean.PageBean.ListBean item) {
                LinearLayout item_ll = helper.getView(R.id.item_ll);
                item_ll.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        if (mUserInfoBean != null && mContentDetailBean != null) {
                            replyPosition = helper.getPosition();
                            if ((mUserInfoBean.getUser().getUserId() + "").equals(mContentDetailBean.getContent().getUserId() + "")) {
                                deleteComment(item, "delete_report");
                            } else if ((mUserInfoBean.getUser().getUserId() + "").equals(item.getUserId() + "")) {
                                deleteComment(item, "delete");
                            } else {
                                deleteComment(item, "report");
                            }
                        }

                    }
                });

                item_ll.setOnLongClickListener(new View.OnLongClickListener() {
                    @Override
                    public boolean onLongClick(View view) {
                        return true;
                    }
                });

                CircleImageView head_photo = helper.getView(R.id.head_photo);
                Glide.with(context)
                        .load(item.getAvatar())
                        .dontAnimate()
                        .placeholder(R.mipmap.icon_no_head)
                        .into(head_photo);
                head_photo.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        Bundle bundle1 = new Bundle();
                        bundle1.putString("userId", item.getUserId() + "");
                        bundle1.putString("userName", item.getNickname() + "");
                        startActivity(OtherInfoActivity.class, bundle1);
                    }
                });

                if (mContentDetailBean != null) {
                    if (item.getUserId() == mContentDetailBean.getContent().getUserId()) {
                        if (mContentDetailBean.getContent().getAnonymity() == 1) {
                            helper.setText(R.id.name, "匿名用户");
                            Glide.with(context)
                                    .load("")
                                    .dontAnimate()
                                    .error(R.mipmap.head_anonymous_orange)
                                    .into(head_photo);
                            head_photo.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View view) {
                                }
                            });
                        } else {
                            helper.setText(R.id.name, item.getNickname());
                            Glide.with(context)
                                    .load(item.getAvatar() + Config.IMAGE_LIM)
                                    .dontAnimate()
                                    .placeholder(R.mipmap.icon_no_head)
                                    .into(head_photo);
                            head_photo.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View view) {
                                    if (Utils.isDoubleClick()) {
                                        return;
                                    }
                                    Bundle bundle1 = new Bundle();
                                    bundle1.putString("userId", item.getUserId() + "");
                                    bundle1.putString("userName", item.getNickname() + "");
                                    startActivity(OtherInfoActivity.class, bundle1);
                                }
                            });
                        }
                    } else {
                        helper.setText(R.id.name, item.getNickname());
                        Glide.with(context)
                                .load(item.getAvatar() + Config.IMAGE_LIM)
                                .dontAnimate()
                                .placeholder(R.mipmap.icon_no_head)
                                .into(head_photo);
                        head_photo.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                if (Utils.isDoubleClick()) {
                                    return;
                                }
                                Bundle bundle1 = new Bundle();
                                bundle1.putString("userId", item.getUserId() + "");
                                bundle1.putString("userName", item.getNickname() + "");
                                startActivity(OtherInfoActivity.class, bundle1);
                            }
                        });
                    }
                } else {
                    helper.setText(R.id.name, item.getNickname());
                    Glide.with(context)
                            .load(item.getAvatar() + Config.IMAGE_LIM)
                            .dontAnimate()
                            .placeholder(R.mipmap.icon_no_head)
                            .into(head_photo);
                    head_photo.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            Bundle bundle1 = new Bundle();
                            bundle1.putString("userId", item.getUserId() + "");
                            bundle1.putString("userName", item.getNickname() + "");
                            startActivity(OtherInfoActivity.class, bundle1);
                        }
                    });
                }


                RichTextView richTextView = helper.getView(R.id.content);
                List<UserModel> list = new ArrayList<>();
                if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                    List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                    if (remindJsons != null) {
                        for (int i = 0; i < remindJsons.size(); i++) {
                            UserModel userModel = new UserModel();
                            userModel.setUser_name(remindJsons.get(i).getNickname());
                            userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                            list.add(userModel);
                        }
                    }
                }
                //直接使用RichTextView
                richTextView.setAtColor(Color.parseColor(getString(R.string.remind_color)));
                richTextView.setLinkColor(Color.BLUE);
                richTextView.setSpanAtUserCallBackListener(spanAtUserCallBack);
                //所有配置完成后才设置text
                if (item.getWeight() == 1) {
                    richTextView.setRichTextUser("[icon_comment_official] " + item.getComment(), list);
                } else if (item.getWeight() == -2) {
                    richTextView.setRichTextUser("[icon_comment_god] " + item.getComment(), list);
                } else {
                    richTextView.setRichTextUser(item.getComment(), list);
                }

                TextView praise = helper.getView(R.id.praise);
                if (item.getIsLike() == 0) {
                    praise.setCompoundDrawablesWithIntrinsicBounds(drawable_unselect, null, null, null);
                } else {
                    praise.setCompoundDrawablesWithIntrinsicBounds(drawable_select, null, null, null);
                }
                praise.setText(item.getLikeSum() + "");
                praise.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        if (item.getIsLike() == 1) {
                            praise.setEnabled(false);
                            showDialog(context, "取消中...");
                            JSONObject jsonObject = new JSONObject();
                            try {
                                jsonObject.put("contentId", item.getId());
                                jsonObject.put("module", 1);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.COMMENT_CANCEL_PRAISE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                @Override
                                public void onSuccess(SendCodeBean sendCodeBean) {
                                    dismissDialog();
                                    praise.setEnabled(true);
                                    if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                        item.setIsLike(0);
                                        item.setLikeSum(item.getLikeSum() - 1);
                                        quickAdapter.notifyDataSetChanged();
                                    } else {
                                        if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                        } else {
                                            showImageToas(sendCodeBean.getMsg());
                                        }
                                    }
                                }

                                @Override
                                public void onError(Response<String> response) {
                                    super.onError(response);
                                    dismissDialog();
                                    praise.setEnabled(true);
                                }
                            });
                        } else {
                            praise.setEnabled(false);
                            showDialog(context, "点赞中...");
                            JSONObject jsonObject = new JSONObject();
                            try {
                                jsonObject.put("contentId", item.getId());
                                jsonObject.put("module", 1);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                            finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.COMMENT_PRAISE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                @Override
                                public void onSuccess(SendCodeBean sendCodeBean) {
                                    dismissDialog();
                                    praise.setEnabled(true);
                                    if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                        item.setIsLike(1);
                                        item.setLikeSum(item.getLikeSum() + 1);
                                        quickAdapter.notifyDataSetChanged();
                                    } else {
                                        if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                        } else {
                                            showImageToas(sendCodeBean.getMsg());
                                        }
                                    }
                                }

                                @Override
                                public void onError(Response<String> response) {
                                    super.onError(response);
                                    dismissDialog();
                                    praise.setEnabled(true);
                                }
                            });
                        }
                    }
                });


                TextView comment = helper.getView(R.id.comment);
                comment.setText(item.getCommentSum() + "");
                comment.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        replyUserId = item.getUserId() + "";
                        replyCommentId = item.getId() + "";
                        et_flag = "receive";
                        if (item.getUserId() == mContentDetailBean.getContent().getUserId()) {
                            if (mContentDetailBean.getContent().getAnonymity() == 1) {
                                replayName = "匿名用户";
                                replayContent = item.getComment();
                            } else {
                                replayName = item.getNickname();
                                replayContent = item.getComment();
                            }
                        } else {
                            replayName = item.getNickname();
                            replayContent = item.getComment();
                        }
                        replyPosition = helper.getPosition();
                        tokenVerify();
                    }
                });

                TextView time = helper.getView(R.id.time);
                timecha(item.getCreateTime(), time);

                LinearLayout receive_ll = helper.getView(R.id.receive_ll);
                TextView more = helper.getView(R.id.more);
                if (item.getLowerComment() != null && item.getLowerComment().size() != 0) {
                    if (item.getCommentSum() > 2) {
                        more.setVisibility(View.VISIBLE);
                        more.setText("查看全部" + item.getCommentSum() + "条回复");
                    } else {
                        more.setVisibility(View.GONE);
                    }
                    receive_ll.setVisibility(View.VISIBLE);
                    receive_ll.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if (Utils.isDoubleClick()) {
                                return;
                            }
                            Bundle bundle1 = new Bundle();
                            bundle1.putString("userId", item.getUserId() + "");
                            bundle1.putString("id", item.getId() + "");
                            bundle1.putString("name", item.getNickname());
                            bundle1.putString("content", item.getComment());
                            bundle1.putString("time", item.getCreateTime());
                            bundle1.putString("head", item.getAvatar());
                            bundle1.putString("praise", item.getLikeSum() + "");
                            bundle1.putString("commentNum", item.getCommentSum() + "");
                            bundle1.putString("contentId", mContentDetailBean.getContent().getId() + "");
                            bundle1.putString("content_userid", mContentDetailBean.getContent().getUserId() + "");
                            bundle1.putString("content_anonymity", mContentDetailBean.getContent().getAnonymity() + "");
                            bundle1.putString("replyCommentId", item.getId() + "");
                            bundle1.putString("isLike", item.getIsLike() + "");
                            CommentRemindJsonBean commentRemindJsonBean = new CommentRemindJsonBean();
                            List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                            commentRemindJsonBean.setList(remindJsons);
                            bundle1.putSerializable("commentRemindJsonBean", commentRemindJsonBean);
                            bundle1.putInt("weight", item.getWeight());
                            startActivity(CommentDetailActivity.class, bundle1);
                        }
                    });

                    XListView receive_listview = helper.getView(R.id.receive_listview);

                    QuickAdapter<CommentListBean.PageBean.ListBean.LowerCommentBean> child_adapter =
                            new QuickAdapter<CommentListBean.PageBean.ListBean.LowerCommentBean>(context, R.layout.item_receive, item.getLowerComment()) {
                                @Override
                                protected void convert(BaseAdapterHelper helper, CommentListBean.PageBean.ListBean.LowerCommentBean item) {
                                    TextView textView = helper.getView(R.id.textview);
                                    if (item.getUserId() == mContentDetailBean.getContent().getUserId()) {
                                        if (mContentDetailBean.getContent().getAnonymity() == 1) {
                                            List<UserModel> list = new ArrayList<>();
                                            if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                                if (remindJsons != null) {
                                                    for (int i = 0; i < remindJsons.size(); i++) {
                                                        UserModel userModel = new UserModel();
                                                        userModel.setUser_name(remindJsons.get(i).getNickname());
                                                        userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                                        list.add(userModel);
                                                    }
                                                }
                                            }
                                            Spannable spannable = TextCommonUtils.getAtText(context, list,
                                                    null,
                                                    "匿名用户" + "(主人回复)：" + item.getComment(),
                                                    iTextViewShow,
                                                    true,
                                                    Color.parseColor(getString(R.string.remind_color)),
                                                    0,
                                                    spanAtUserCallBack,
                                                    null);
                                            Spannable spannable1 = new SpannableString(spannable);
                                            spannable1.setSpan(span, 0, ("匿名用户" + "(主人回复)：").length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                                            textView.setText(spannable1);
                                        } else {
                                            List<UserModel> list = new ArrayList<>();
                                            if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                                if (remindJsons != null) {
                                                    for (int i = 0; i < remindJsons.size(); i++) {
                                                        UserModel userModel = new UserModel();
                                                        userModel.setUser_name(remindJsons.get(i).getNickname());
                                                        userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                                        list.add(userModel);
                                                    }
                                                }
                                            }
                                            Spannable spannable = TextCommonUtils.getAtText(context, list,
                                                    null,
                                                    item.getNickname() + "(主人回复)：" + item.getComment(),
                                                    iTextViewShow,
                                                    true,
                                                    Color.parseColor(getString(R.string.remind_color)),
                                                    0,
                                                    spanAtUserCallBack,
                                                    null);
                                            Spannable spannable1 = new SpannableString(spannable);
                                            spannable1.setSpan(span, 0, (item.getNickname() + "(主人回复)：").length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                                            textView.setText(spannable1);
                                        }
                                    } else {
                                        if (item.getReplyNickname().equals(mContentDetailBean.getContent().getNickname())) {
                                            if (mContentDetailBean.getContent().getAnonymity() == 1) {
                                                List<UserModel> list = new ArrayList<>();
                                                if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                                    List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                                    if (remindJsons != null) {
                                                        for (int i = 0; i < remindJsons.size(); i++) {
                                                            UserModel userModel = new UserModel();
                                                            userModel.setUser_name(remindJsons.get(i).getNickname());
                                                            userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                                            list.add(userModel);
                                                        }
                                                    }
                                                }
                                                Spannable spannable = TextCommonUtils.getAtText(context, list,
                                                        null,
                                                        item.getNickname() + "回复" + "匿名用户（主人）" + ":" + item.getComment(),
                                                        iTextViewShow,
                                                        true,
                                                        Color.parseColor(getString(R.string.remind_color)),
                                                        0,
                                                        spanAtUserCallBack,
                                                        null);

                                                SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(spannable);
                                                spannableStringBuilder.setSpan(span, 0, item.getNickname().length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                                spannableStringBuilder.setSpan(span1, item.getNickname().length(), item.getNickname().length() + 2, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                                spannableStringBuilder.setSpan(span2, item.getNickname().length() + 2, item.getNickname().length() + 2 + ("匿名用户（主人）").length() + 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                                textView.setText(spannableStringBuilder);
                                            } else {
                                                List<UserModel> list = new ArrayList<>();
                                                if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                                    List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                                    if (remindJsons != null) {
                                                        for (int i = 0; i < remindJsons.size(); i++) {
                                                            UserModel userModel = new UserModel();
                                                            userModel.setUser_name(remindJsons.get(i).getNickname());
                                                            userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                                            list.add(userModel);
                                                        }
                                                    }
                                                }
                                                Spannable spannable = TextCommonUtils.getAtText(context, list,
                                                        null,
                                                        item.getNickname() + "回复" + item.getReplyNickname() + ":" + item.getComment(),
                                                        iTextViewShow,
                                                        true,
                                                        Color.parseColor(getString(R.string.remind_color)),
                                                        0,
                                                        spanAtUserCallBack,
                                                        null);

                                                SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(spannable);
                                                spannableStringBuilder.setSpan(span, 0, item.getNickname().length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                                spannableStringBuilder.setSpan(span1, item.getNickname().length(), item.getNickname().length() + 2, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                                spannableStringBuilder.setSpan(span2, item.getNickname().length() + 2, item.getNickname().length() + 2 + item.getReplyNickname().length() + 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                                textView.setText(spannableStringBuilder);
                                            }
                                        } else {
                                            List<UserModel> list = new ArrayList<>();
                                            if (!TextUtils.isEmpty(item.getRemindJson()) && !"[]".equals(item.getRemindJson())) {
                                                List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                                                if (remindJsons != null) {
                                                    for (int i = 0; i < remindJsons.size(); i++) {
                                                        UserModel userModel = new UserModel();
                                                        userModel.setUser_name(remindJsons.get(i).getNickname());
                                                        userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                                        list.add(userModel);
                                                    }
                                                }
                                            }
                                            Spannable spannable = TextCommonUtils.getAtText(context, list,
                                                    null,
                                                    item.getNickname() + "回复" + item.getReplyNickname() + ":" + item.getComment(),
                                                    iTextViewShow,
                                                    true,
                                                    Color.parseColor(getString(R.string.remind_color)),
                                                    0,
                                                    spanAtUserCallBack,
                                                    null);

                                            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(spannable);
                                            spannableStringBuilder.setSpan(span, 0, item.getNickname().length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                            spannableStringBuilder.setSpan(span1, item.getNickname().length(), item.getNickname().length() + 2, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                            spannableStringBuilder.setSpan(span2, item.getNickname().length() + 2, item.getNickname().length() + 2 + item.getReplyNickname().length() + 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
                                            textView.setText(spannableStringBuilder);
                                        }
                                    }
                                }
                            };

                    receive_listview.setAdapter(child_adapter);
                    receive_listview.setFocusable(false);
                    receive_listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                            Bundle bundle1 = new Bundle();
                            bundle1.putString("userId", item.getUserId() + "");
                            bundle1.putString("id", item.getId() + "");
                            bundle1.putString("name", item.getNickname());
                            bundle1.putString("content", item.getComment());
                            bundle1.putString("time", item.getCreateTime());
                            bundle1.putString("head", item.getAvatar());
                            bundle1.putString("praise", item.getLikeSum() + "");
                            bundle1.putString("commentNum", item.getCommentSum() + "");
                            bundle1.putString("contentId", mContentDetailBean.getContent().getId() + "");
                            bundle1.putString("content_userid", mContentDetailBean.getContent().getUserId() + "");
                            bundle1.putString("content_anonymity", mContentDetailBean.getContent().getAnonymity() + "");
                            bundle1.putString("replyCommentId", item.getId() + "");
                            bundle1.putString("isLike", item.getIsLike() + "");
                            CommentRemindJsonBean commentRemindJsonBean = new CommentRemindJsonBean();
                            List<RemindJson> remindJsons = GsonUtil.jsonToList(item.getRemindJson(), RemindJson.class);
                            commentRemindJsonBean.setList(remindJsons);
                            bundle1.putSerializable("commentRemindJsonBean", commentRemindJsonBean);
                            bundle1.putInt("weight", item.getWeight());
                            startActivity(CommentDetailActivity.class, bundle1);
                        }
                    });
                } else {
                    receive_ll.setVisibility(View.GONE);
                }
            }
        };

        commentListview.setAdapter(quickAdapter);
        commentListview.setFocusable(false);

        voteAdapter = new QuickAdapter<ContentVoteListBean>(context, R.layout.item_vote) {
            @Override
            protected void convert(BaseAdapterHelper voteHelper, ContentVoteListBean voteItem) {
                TextView vote_tab_yes = voteHelper.getView(R.id.vote_tab_yes);
                TextView vote_tab_no = voteHelper.getView(R.id.vote_tab_no);
                TextView vote_num = voteHelper.getView(R.id.vote_num);
                ProgressBar progressBar = voteHelper.getView(R.id.progressBar);
                LinearLayout item_ll = voteHelper.getView(R.id.item_ll);

                if (mUserInfoBean != null) {
                    if (mContentDetailBean.getContent().getUserId() == mUserInfoBean.getUser().getUserId()) {
                        vote_tab_yes.setVisibility(View.VISIBLE);
                        vote_num.setVisibility(View.VISIBLE);
                        progressBar.setVisibility(View.VISIBLE);
                        vote_tab_no.setVisibility(View.INVISIBLE);

                        vote_tab_yes.setText(voteItem.getName());
                        vote_num.setText(voteItem.getVoteSum() + "票");

                        progressBar.setMax(mContentDetailBean.getContent().getVoteTotal());
                        progressBar.setProgress(voteItem.getVoteSum());
                    } else {
                        if (mContentDetailBean.getContent().getIsVoted() == 1) {
                            vote_tab_yes.setVisibility(View.VISIBLE);
                            vote_num.setVisibility(View.VISIBLE);
                            progressBar.setVisibility(View.VISIBLE);
                            vote_tab_no.setVisibility(View.INVISIBLE);

                            vote_tab_yes.setText(voteItem.getName());
                            vote_num.setText(voteItem.getVoteSum() + "票");

                            progressBar.setMax(mContentDetailBean.getContent().getVoteTotal());
                            progressBar.setProgress(voteItem.getVoteSum());
                        } else {
                            vote_tab_yes.setVisibility(View.INVISIBLE);
                            vote_num.setVisibility(View.INVISIBLE);
                            progressBar.setVisibility(View.INVISIBLE);
                            vote_tab_no.setVisibility(View.VISIBLE);

                            vote_tab_no.setText(voteItem.getName());
                        }
                    }
                } else {
                    vote_tab_yes.setVisibility(View.INVISIBLE);
                    vote_num.setVisibility(View.INVISIBLE);
                    progressBar.setVisibility(View.INVISIBLE);
                    vote_tab_no.setVisibility(View.VISIBLE);

                    vote_tab_no.setText(voteItem.getName());
                }

                item_ll.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        if (Utils.isDoubleClick()) {
                            return;
                        }
                        if (mContentDetailBean.getContent().getIsVoted() == 1) {
                            if (voteItem.getIsVote() == 1) {
                                item_ll.setEnabled(false);
                                showDialog(context, "取消中...");
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentVoteId", voteItem.getId());
                                    jsonObject.put("contentId", voteItem.getContentId());
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCE_HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                    @Override
                                    public void onSuccess(SendCodeBean sendCodeBean) {
                                        dismissDialog();
                                        item_ll.setEnabled(true);
                                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                            mContentDetailBean.getContent().setIsVoted(0);
                                            mContentDetailBean.getContent().setVoteTotal(mContentDetailBean.getContent().getVoteTotal() - 1);
                                            voteItem.setVoteSum(voteItem.getVoteSum() - 1);
                                            voteItem.setIsVote(0);
                                            notifyDataSetChanged();
                                        } else {
                                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
//                                                    showImageToas(sendCodeBean.getMsg());
                                            }
                                        }
                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                        item_ll.setEnabled(true);
                                    }
                                });
                            }
                        } else {
                            if (voteItem.getIsVote() == 0) {
                                item_ll.setEnabled(false);
                                showDialog(context, "投票中...");
                                JSONObject jsonObject = new JSONObject();
                                try {
                                    jsonObject.put("contentId", voteItem.getContentId());
                                    jsonObject.put("contentVoteId", voteItem.getId());
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                                finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.HOME_VOTE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                                    @Override
                                    public void onSuccess(SendCodeBean sendCodeBean) {
                                        dismissDialog();
                                        item_ll.setEnabled(true);
                                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                            mContentDetailBean.getContent().setIsVoted(1);
                                            mContentDetailBean.getContent().setVoteTotal(mContentDetailBean.getContent().getVoteTotal() + 1);
                                            voteItem.setVoteSum(voteItem.getVoteSum() + 1);
                                            voteItem.setIsVote(1);
                                            notifyDataSetChanged();
                                        } else {
                                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                            } else {
//                                                    showImageToas(sendCodeBean.getMsg());
                                            }
                                        }
                                    }

                                    @Override
                                    public void onError(Response<String> response) {
                                        super.onError(response);
                                        dismissDialog();
                                        item_ll.setEnabled(true);
                                    }
                                });
                            }
                        }
                    }
                });

            }
        };
        vote_num_listview.setAdapter(voteAdapter);
        vote_num_listview.setFocusable(false);

        invitation_adapter = new QuickAdapter<InvitationBean>(context, R.layout.item_invitation_status) {
            @Override
            protected void convert(BaseAdapterHelper helper, InvitationBean item) {
                ImageView point = helper.getView(R.id.point);
                if (item.getStatus() == 1) {
                    point.setImageResource(R.mipmap.icon_invitation_point_select);
                } else {
                    point.setImageResource(R.mipmap.icon_invitation_point_unselect);
                }

                helper.setText(R.id.invitation_title, item.getTitle());
                helper.setText(R.id.invitation_desc, item.getDesc());

                FrameLayout frameLayout = helper.getView(R.id.framelayout);
                View line = helper.getView(R.id.line);

                if (helper.getPosition() == invitation_adapter.getCount() - 1) {
                    if (!TextUtils.isEmpty(item.getDesc())) {
                        line.setVisibility(View.VISIBLE);
                        frameLayout.setVisibility(View.VISIBLE);
                        frameLayout.measure(0, 0);
                        line.setMinimumHeight(frameLayout.getMeasuredHeight());
                    } else {
                        frameLayout.setVisibility(View.GONE);
                        line.setVisibility(View.GONE);
                    }
                } else {
                    frameLayout.setVisibility(View.VISIBLE);
                    line.setVisibility(View.VISIBLE);
                    frameLayout.measure(0, 0);
                    line.setMinimumHeight(frameLayout.getMeasuredHeight());
                }
            }
        };

        invitation_status.setAdapter(invitation_adapter);
        invitation_status.setFocusable(false);
    }


    @Override
    protected void initData() {
        showDialog(context, null);
        HttpParams params = new HttpParams();
        params.put("contentId", id);
        if (mUserInfoBean != null) {
            params.put("userId", mUserInfoBean.getUser().getUserId());
        }
        finalOkGo.request(RequestType.POST, Url.ADD_WATCH_CONTENT, params, Url.ADD_WATCH_CONTENT, new Callback<SendCodeBean>() {
            @Override
            public void onSuccess(SendCodeBean sendCodeBean) {
                HttpParams params = new HttpParams();
                params.put("contentId", id);
                if (mUserInfoBean != null) {
                    params.put("userId", mUserInfoBean.getUser().getUserId());
                }
                finalOkGo.request(RequestType.POST, Url.BY_ID_DETAIL, params, Url.BY_ID_DETAIL, new Callback<ContentDetailBean>() {
                    @Override
                    public void onSuccess(ContentDetailBean contentDetailBean) {
                        dismissDialog();
                        if (contentDetailBean.getCode() == Contacts.SUCCESS) {
                            empty_rl.setVisibility(View.GONE);
                            mContentDetailBean = contentDetailBean;

                            if (contentDetailBean.getContent().getIsVote() == 1) {
                                vote_num_listview.setVisibility(View.VISIBLE);

                                voteAdapter.clear();
                                voteAdapter.addAll(contentDetailBean.getContent().getContentVoteList());
                                voteAdapter.notifyDataSetChanged();
                            } else {
                                vote_num_listview.setVisibility(View.GONE);
                            }

                            requestComment();
                            if (contentDetailBean.getContent().getType() == 3) {
                                if (contentDetailBean.getContent().getAnonymity() == 1) {
                                    Glide.with(context)
                                            .load("")
                                            .dontAnimate()
                                            .placeholder(R.mipmap.head_anonymous_orange)
                                            .into(headPhoto);
                                    Glide.with(context)
                                            .load("")
                                            .dontAnimate()
                                            .placeholder(R.mipmap.head_anonymous_orange)
                                            .into(headPhotoTop);
                                } else {
                                    Glide.with(context)
                                            .load(mContentDetailBean.getContent().getAvatar() + Config.IMAGE_LIM)
                                            .dontAnimate()
                                            .placeholder(R.mipmap.icon_no_head)
                                            .into(headPhoto);
                                    Glide.with(context)
                                            .load(mContentDetailBean.getContent().getAvatar() + Config.IMAGE_LIM)
                                            .dontAnimate()
                                            .placeholder(R.mipmap.icon_no_head)
                                            .into(headPhotoTop);
                                }
                            } else if (contentDetailBean.getContent().getType() == 2) {
                                nineGrid.setVisibility(View.VISIBLE);

                                if (contentDetailBean.getContent().getAnonymity() == 1) {
                                    Glide.with(context)
                                            .load("")
                                            .dontAnimate()
                                            .placeholder(R.mipmap.head_anonymous_purple)
                                            .into(headPhoto);
                                    Glide.with(context)
                                            .load("")
                                            .dontAnimate()
                                            .placeholder(R.mipmap.head_anonymous_purple)
                                            .into(headPhotoTop);
                                } else {
                                    Glide.with(context)
                                            .load(mContentDetailBean.getContent().getAvatar() + Config.IMAGE_LIM)
                                            .dontAnimate()
                                            .placeholder(R.mipmap.icon_no_head)
                                            .into(headPhoto);
                                    Glide.with(context)
                                            .load(mContentDetailBean.getContent().getAvatar() + Config.IMAGE_LIM)
                                            .dontAnimate()
                                            .placeholder(R.mipmap.icon_no_head)
                                            .into(headPhotoTop);
                                }

                                List<String> list = Arrays.asList(contentDetailBean.getContent().getUrls().split("\\|"));
                                ArrayList<ImageInfo> imageInfo = new ArrayList<>();
                                for (int i = 0; i < list.size(); i++) {
                                    ImageInfo info = new ImageInfo();
                                    info.setThumbnailUrl(list.get(i) + Config.IMAGE_LIM);
                                    info.setBigImageUrl(list.get(i));
                                    imageInfo.add(info);
                                }
                                nineGrid.setAdapter(new MyNineGridViewAdapter(context, imageInfo));

                            } else if (contentDetailBean.getContent().getType() == 1) {

                                Glide.with(context)
                                        .load(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1")
                                        .asBitmap()
                                        .into(new SimpleTarget<Bitmap>() {
                                            @Override
                                            public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                                                if (resource.getHeight() > resource.getWidth()) {
                                                    //4:3
                                                    container1.setVisibility(View.VISIBLE);

                                                    if (contentDetailBean.getContent().getAnonymity() == 1) {
                                                        Glide.with(context)
                                                                .load("")
                                                                .dontAnimate()
                                                                .placeholder(R.mipmap.head_anonymous_orange)
                                                                .into(headPhoto);
                                                        Glide.with(context)
                                                                .load("")
                                                                .dontAnimate()
                                                                .placeholder(R.mipmap.head_anonymous_orange)
                                                                .into(headPhotoTop);
                                                    } else {
                                                        Glide.with(context)
                                                                .load(mContentDetailBean.getContent().getAvatar() + Config.IMAGE_LIM)
                                                                .dontAnimate()
                                                                .placeholder(R.mipmap.icon_no_head)
                                                                .into(headPhoto);
                                                        Glide.with(context)
                                                                .load(mContentDetailBean.getContent().getAvatar() + Config.IMAGE_LIM)
                                                                .dontAnimate()
                                                                .placeholder(R.mipmap.icon_no_head)
                                                                .into(headPhotoTop);
                                                    }

                                                    videoView = new VideoView(context);
                                                    removePlayerFormParent(videoView);
                                                    standardVideoController = new StandardVideoController(context);
                                                    videoView.setVideoController(standardVideoController);
                                                    standardVideoController.setPlayState(videoView.getCurrentPlayState());
                                                    standardVideoController.setPlayerState(videoView.getCurrentPlayerState());

                                                    String playUrl = mPreloadManager.getPlayUrl(contentDetailBean.getContent().getUrls());
                                                    videoView.setUrl(playUrl);
                                                    videoView.setLooping(true);
                                                    videoView.setScreenScaleType(VideoView.SCREEN_SCALE_CENTER_CROP);
                                                    videoView.setMute(true);
                                                    videoView.start();
                                                    videoView.setMute(true);
                                                    videoView.start();
                                                    Logger.e("video_0");

                                                    Glide.with(context)
                                                            .load(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1")
                                                            .crossFade()
                                                            .placeholder(android.R.color.darker_gray)
                                                            .into(standardVideoController.getThumb());

                                                    standardVideoController.getThumb().setOnClickListener(new View.OnClickListener() {
                                                        @Override
                                                        public void onClick(View view) {
                                                            if (Utils.isDoubleClick()) {
                                                                return;
                                                            }
                                                            Bundle bundle1 = new Bundle();
                                                            VideoListBean videoListBean = new VideoListBean();
                                                            videoListBean.setVideoDownloadUrl(contentDetailBean.getContent().getUrls());
                                                            videoListBean.setCoverImgUrl(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                                                            videoListBean.setTitle(contentDetailBean.getContent().getTitle());
                                                            videoListBean.setComment_num(contentDetailBean.getContent().getCommentSum());
                                                            videoListBean.setPraise_num(contentDetailBean.getContent().getLikeSum());
                                                            videoListBean.setHeadPhoto(contentDetailBean.getContent().getAvatar());
                                                            videoListBean.setNickName(contentDetailBean.getContent().getNickname());
                                                            videoListBean.setTime(contentDetailBean.getContent().getCreateTime());
                                                            videoListBean.setIsLike(contentDetailBean.getContent().getIsLike());
                                                            videoListBean.setAnonymity(contentDetailBean.getContent().getAnonymity());
                                                            videoListBean.setUserId(contentDetailBean.getContent().getUserId());
                                                            videoListBean.setContentId(contentDetailBean.getContent().getId());
                                                            List<RemindJson> remindJsons = GsonUtil.jsonToList(contentDetailBean.getContent().getRemindJson(), RemindJson.class);
                                                            videoListBean.setList(remindJsons);
                                                            bundle1.putSerializable("data", videoListBean);
                                                            bundle1.putInt("videoId", contentDetailBean.getContent().getId());
                                                            bundle1.putString("flag", "praise");
                                                            bundle1.putString("categoriesId", contentDetailBean.getContent().getCategoriesId() + "");
                                                            bundle1.putInt("position", 0);
                                                            startActivity(VideoDetailActivity.class, bundle1);
                                                        }
                                                    });

                                                    standardVideoController.findViewById(R.id.start_play).setOnClickListener(new View.OnClickListener() {
                                                        @Override
                                                        public void onClick(View view) {
                                                            if (Utils.isDoubleClick()) {
                                                                return;
                                                            }
                                                            Bundle bundle1 = new Bundle();
                                                            VideoListBean videoListBean = new VideoListBean();
                                                            videoListBean.setVideoDownloadUrl(contentDetailBean.getContent().getUrls());
                                                            videoListBean.setCoverImgUrl(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                                                            videoListBean.setTitle(contentDetailBean.getContent().getTitle());
                                                            videoListBean.setComment_num(contentDetailBean.getContent().getCommentSum());
                                                            videoListBean.setPraise_num(contentDetailBean.getContent().getLikeSum());
                                                            videoListBean.setHeadPhoto(contentDetailBean.getContent().getAvatar());
                                                            videoListBean.setNickName(contentDetailBean.getContent().getNickname());
                                                            videoListBean.setTime(contentDetailBean.getContent().getCreateTime());
                                                            videoListBean.setIsLike(contentDetailBean.getContent().getIsLike());
                                                            videoListBean.setAnonymity(contentDetailBean.getContent().getAnonymity());
                                                            videoListBean.setUserId(contentDetailBean.getContent().getUserId());
                                                            videoListBean.setContentId(contentDetailBean.getContent().getId());
                                                            List<RemindJson> remindJsons = GsonUtil.jsonToList(contentDetailBean.getContent().getRemindJson(), RemindJson.class);
                                                            videoListBean.setList(remindJsons);
                                                            bundle1.putSerializable("data", videoListBean);
                                                            bundle1.putInt("videoId", contentDetailBean.getContent().getId());
                                                            bundle1.putString("flag", "praise");
                                                            bundle1.putString("categoriesId", contentDetailBean.getContent().getCategoriesId() + "");
                                                            bundle1.putInt("position", 0);
                                                            startActivity(VideoDetailActivity.class, bundle1);
                                                        }
                                                    });

                                                    standardVideoController.setOnClickListener(view12 -> {
                                                        if (Utils.isDoubleClick()) {
                                                            return;
                                                        }
                                                        Bundle bundle1 = new Bundle();
                                                        VideoListBean videoListBean = new VideoListBean();
                                                        videoListBean.setVideoDownloadUrl(contentDetailBean.getContent().getUrls());
                                                        videoListBean.setCoverImgUrl(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                                                        videoListBean.setTitle(contentDetailBean.getContent().getTitle());
                                                        videoListBean.setComment_num(contentDetailBean.getContent().getCommentSum());
                                                        videoListBean.setPraise_num(contentDetailBean.getContent().getLikeSum());
                                                        videoListBean.setHeadPhoto(contentDetailBean.getContent().getAvatar());
                                                        videoListBean.setNickName(contentDetailBean.getContent().getNickname());
                                                        videoListBean.setTime(contentDetailBean.getContent().getCreateTime());
                                                        videoListBean.setIsLike(contentDetailBean.getContent().getIsLike());
                                                        videoListBean.setAnonymity(contentDetailBean.getContent().getAnonymity());
                                                        videoListBean.setUserId(contentDetailBean.getContent().getUserId());
                                                        videoListBean.setContentId(contentDetailBean.getContent().getId());
                                                        List<RemindJson> remindJsons = GsonUtil.jsonToList(contentDetailBean.getContent().getRemindJson(), RemindJson.class);
                                                        videoListBean.setList(remindJsons);
                                                        bundle1.putSerializable("data", videoListBean);
                                                        bundle1.putInt("videoId", contentDetailBean.getContent().getId());
                                                        bundle1.putString("flag", "praise");
                                                        bundle1.putString("categoriesId", contentDetailBean.getContent().getCategoriesId() + "");
                                                        bundle1.putInt("position", 0);
                                                        startActivity(VideoDetailActivity.class, bundle1);
                                                    });
                                                    VideoPraiseHashMap.getIntance().put(contentDetailBean.getContent().getId(), videoView);
                                                    container1.addView(videoView);
                                                } else {
                                                    //3:2
                                                    container2.setVisibility(View.VISIBLE);

                                                    if (contentDetailBean.getContent().getAnonymity() == 1) {
                                                        Glide.with(context)
                                                                .load("")
                                                                .dontAnimate()
                                                                .placeholder(R.mipmap.head_anonymous_green)
                                                                .into(headPhoto);
                                                        Glide.with(context)
                                                                .load("")
                                                                .dontAnimate()
                                                                .placeholder(R.mipmap.head_anonymous_green)
                                                                .into(headPhotoTop);
                                                    } else {
                                                        Glide.with(context)
                                                                .load(mContentDetailBean.getContent().getAvatar() + Config.IMAGE_LIM)
                                                                .dontAnimate()
                                                                .placeholder(R.mipmap.icon_no_head)
                                                                .into(headPhoto);
                                                        Glide.with(context)
                                                                .load(mContentDetailBean.getContent().getAvatar() + Config.IMAGE_LIM)
                                                                .dontAnimate()
                                                                .placeholder(R.mipmap.icon_no_head)
                                                                .into(headPhotoTop);
                                                    }

                                                    videoView = new VideoView(context);
                                                    removePlayerFormParent(videoView);
                                                    standardVideoController = new StandardVideoController(context);
                                                    videoView.setVideoController(standardVideoController);
                                                    standardVideoController.setPlayState(videoView.getCurrentPlayState());
                                                    standardVideoController.setPlayerState(videoView.getCurrentPlayerState());

                                                    String playUrl = mPreloadManager.getPlayUrl(contentDetailBean.getContent().getUrls());
                                                    videoView.setUrl(playUrl);
                                                    videoView.setLooping(true);
                                                    videoView.setScreenScaleType(VideoView.SCREEN_SCALE_CENTER_CROP);
                                                    videoView.setMute(true);
                                                    videoView.start();
                                                    videoView.setMute(true);
                                                    videoView.start();
                                                    Logger.e("video_1");

                                                    Glide.with(context)
                                                            .load(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1")
                                                            .crossFade()
                                                            .placeholder(android.R.color.darker_gray)
                                                            .into(standardVideoController.getThumb());

                                                    standardVideoController.getThumb().setOnClickListener(new View.OnClickListener() {
                                                        @Override
                                                        public void onClick(View view) {
                                                            if (Utils.isDoubleClick()) {
                                                                return;
                                                            }
                                                            Bundle bundle1 = new Bundle();
                                                            VideoListBean videoListBean = new VideoListBean();
                                                            videoListBean.setVideoDownloadUrl(contentDetailBean.getContent().getUrls());
                                                            videoListBean.setCoverImgUrl(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                                                            videoListBean.setTitle(contentDetailBean.getContent().getTitle());
                                                            videoListBean.setComment_num(contentDetailBean.getContent().getCommentSum());
                                                            videoListBean.setPraise_num(contentDetailBean.getContent().getLikeSum());
                                                            videoListBean.setHeadPhoto(contentDetailBean.getContent().getAvatar());
                                                            videoListBean.setNickName(contentDetailBean.getContent().getNickname());
                                                            videoListBean.setTime(contentDetailBean.getContent().getCreateTime());
                                                            videoListBean.setIsLike(contentDetailBean.getContent().getIsLike());
                                                            videoListBean.setAnonymity(contentDetailBean.getContent().getAnonymity());
                                                            videoListBean.setUserId(contentDetailBean.getContent().getUserId());
                                                            videoListBean.setContentId(contentDetailBean.getContent().getId());
                                                            List<RemindJson> remindJsons = GsonUtil.jsonToList(contentDetailBean.getContent().getRemindJson(), RemindJson.class);
                                                            videoListBean.setList(remindJsons);
                                                            bundle1.putSerializable("data", videoListBean);
                                                            bundle1.putInt("videoId", contentDetailBean.getContent().getId());
                                                            bundle1.putString("flag", "praise");
                                                            bundle1.putString("categoriesId", contentDetailBean.getContent().getCategoriesId() + "");
                                                            bundle1.putInt("position", 0);
                                                            startActivity(VideoDetailActivity.class, bundle1);
                                                        }
                                                    });

                                                    standardVideoController.findViewById(R.id.start_play).setOnClickListener(new View.OnClickListener() {
                                                        @Override
                                                        public void onClick(View view) {
                                                            if (Utils.isDoubleClick()) {
                                                                return;
                                                            }
                                                            Bundle bundle1 = new Bundle();
                                                            VideoListBean videoListBean = new VideoListBean();
                                                            videoListBean.setVideoDownloadUrl(contentDetailBean.getContent().getUrls());
                                                            videoListBean.setCoverImgUrl(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                                                            videoListBean.setTitle(contentDetailBean.getContent().getTitle());
                                                            videoListBean.setComment_num(contentDetailBean.getContent().getCommentSum());
                                                            videoListBean.setPraise_num(contentDetailBean.getContent().getLikeSum());
                                                            videoListBean.setHeadPhoto(contentDetailBean.getContent().getAvatar());
                                                            videoListBean.setNickName(contentDetailBean.getContent().getNickname());
                                                            videoListBean.setTime(contentDetailBean.getContent().getCreateTime());
                                                            videoListBean.setIsLike(contentDetailBean.getContent().getIsLike());
                                                            videoListBean.setAnonymity(contentDetailBean.getContent().getAnonymity());
                                                            videoListBean.setUserId(contentDetailBean.getContent().getUserId());
                                                            videoListBean.setContentId(contentDetailBean.getContent().getId());
                                                            List<RemindJson> remindJsons = GsonUtil.jsonToList(contentDetailBean.getContent().getRemindJson(), RemindJson.class);
                                                            videoListBean.setList(remindJsons);
                                                            bundle1.putSerializable("data", videoListBean);
                                                            bundle1.putInt("videoId", contentDetailBean.getContent().getId());
                                                            bundle1.putString("flag", "praise");
                                                            bundle1.putString("categoriesId", contentDetailBean.getContent().getCategoriesId() + "");
                                                            bundle1.putInt("position", 0);
                                                            startActivity(VideoDetailActivity.class, bundle1);
                                                        }
                                                    });

                                                    standardVideoController.setOnClickListener(view12 -> {
                                                        if (Utils.isDoubleClick()) {
                                                            return;
                                                        }
                                                        Bundle bundle1 = new Bundle();
                                                        VideoListBean videoListBean = new VideoListBean();
                                                        videoListBean.setVideoDownloadUrl(contentDetailBean.getContent().getUrls());
                                                        videoListBean.setCoverImgUrl(contentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                                                        videoListBean.setTitle(contentDetailBean.getContent().getTitle());
                                                        videoListBean.setComment_num(contentDetailBean.getContent().getCommentSum());
                                                        videoListBean.setPraise_num(contentDetailBean.getContent().getLikeSum());
                                                        videoListBean.setHeadPhoto(contentDetailBean.getContent().getAvatar());
                                                        videoListBean.setNickName(contentDetailBean.getContent().getNickname());
                                                        videoListBean.setTime(contentDetailBean.getContent().getCreateTime());
                                                        videoListBean.setIsLike(contentDetailBean.getContent().getIsLike());
                                                        videoListBean.setAnonymity(contentDetailBean.getContent().getAnonymity());
                                                        videoListBean.setUserId(contentDetailBean.getContent().getUserId());
                                                        videoListBean.setContentId(contentDetailBean.getContent().getId());
                                                        List<RemindJson> remindJsons = GsonUtil.jsonToList(contentDetailBean.getContent().getRemindJson(), RemindJson.class);
                                                        videoListBean.setList(remindJsons);
                                                        bundle1.putSerializable("data", videoListBean);
                                                        bundle1.putInt("videoId", contentDetailBean.getContent().getId());
                                                        bundle1.putString("flag", "praise");
                                                        bundle1.putString("categoriesId", contentDetailBean.getContent().getCategoriesId() + "");
                                                        bundle1.putInt("position", 0);
                                                        startActivity(VideoDetailActivity.class, bundle1);
                                                    });
                                                    VideoPraiseHashMap.getIntance().put(contentDetailBean.getContent().getId(), videoView);
                                                    container2.addView(videoView);
                                                }
                                            }


                                        });


                            }

                            if (!TextUtils.isEmpty(contentDetailBean.getContent().getTitle())) {

                                List<UserModel> list = new ArrayList<>();
                                if (!TextUtils.isEmpty(contentDetailBean.getContent().getRemindJson()) && !"[]".equals(contentDetailBean.getContent().getRemindJson())) {
                                    List<RemindJson> remindJsons = GsonUtil.jsonToList(contentDetailBean.getContent().getRemindJson(), RemindJson.class);
                                    if (remindJsons != null) {
                                        for (int i = 0; i < remindJsons.size(); i++) {
                                            UserModel userModel = new UserModel();
                                            userModel.setUser_name(remindJsons.get(i).getNickname());
                                            userModel.setUser_id(remindJsons.get(i).getUserId() + "");
                                            list.add(userModel);
                                        }
                                    }
                                }

                                content.setVisibility(View.VISIBLE);
//                content.setText(listBean.getTitle());
                                //直接使用RichTextView
                                content.setAtColor(Color.parseColor(getString(R.string.remind_color)));
                                content.setLinkColor(Color.BLUE);
                                content.setSpanAtUserCallBackListener(spanAtUserCallBack);
                                //所有配置完成后才设置text
                                content.setRichTextUser(contentDetailBean.getContent().getTitle(), list);
                            } else {
                                content.setVisibility(View.GONE);
                            }

                            if (contentDetailBean.getContent().getRewardMoney() == null || contentDetailBean.getContent().getRewardMoney().compareTo(new BigDecimal(0)) == 0) {
                                award_ll.setVisibility(View.GONE);
                            } else {
                                award_ll.setVisibility(View.VISIBLE);
                                award_tv.setText("该贴已获得发布奖励" + contentDetailBean.getContent().getRewardMoney().stripTrailingZeros().toPlainString() + "元");
                            }

                            if (contentDetailBean.getContent().getSzcgStatus() == 0) {
                                invitation_status_ll.setVisibility(View.GONE);
                            } else {
                                invitation_status_ll.setVisibility(View.VISIBLE);
                                invitation_adapter.clear();
                                for (int i = 0; i < 4; i++) {
                                    InvitationBean invitationBean = new InvitationBean();
                                    if (i == 0) {
                                        invitationBean.setTitle("已推送");
                                        if (contentDetailBean.getCaseDescribeList().size() > 0) {
                                            invitationBean.setDesc(contentDetailBean.getCaseDescribeList().get(i));
                                        }
//                                        if (contentDetailBean.getContent().getSzcgStatus() > 0 || contentDetailBean.getContent().getSzcgStatus() == -1) {
//                                            invitationBean.setStatus(1);
//                                        }
                                        if (contentDetailBean.getContent().getSzcgStatus() == 1) {
                                            invitationBean.setStatus(1);
                                        }
                                    } else if (i == 1) {
                                        invitationBean.setTitle("已受理");
                                        if (contentDetailBean.getCaseDescribeList().size() > 1) {
                                            invitationBean.setDesc(contentDetailBean.getCaseDescribeList().get(i));
                                        }
//                                        if (contentDetailBean.getContent().getSzcgStatus() > 1 || contentDetailBean.getContent().getSzcgStatus() == -1) {
//                                            invitationBean.setStatus(1);
//                                        }
                                        if (contentDetailBean.getContent().getSzcgStatus() == 2) {
                                            invitationBean.setStatus(1);
                                        }
                                    } else if (i == 2) {
                                        invitationBean.setTitle("处理中");
                                        if (contentDetailBean.getCaseDescribeList().size() > 2) {
                                            invitationBean.setDesc(contentDetailBean.getCaseDescribeList().get(i));
                                        }
//                                        if (contentDetailBean.getContent().getSzcgStatus() > 2 || contentDetailBean.getContent().getSzcgStatus() == -1) {
//                                            invitationBean.setStatus(1);
//                                        }
                                        if (contentDetailBean.getContent().getSzcgStatus() == 3 || contentDetailBean.getContent().getSzcgStatus() == -1) {
                                            invitationBean.setStatus(1);
                                        }
                                    } else if (i == 3) {
                                        invitationBean.setTitle("已结案");
                                        if (contentDetailBean.getCaseDescribeList().size() > 3) {
                                            invitationBean.setDesc(contentDetailBean.getCaseDescribeList().get(i));
                                        }
//                                        if (contentDetailBean.getContent().getSzcgStatus() > 3) {
//                                            invitationBean.setStatus(1);
//                                        }
                                        if (contentDetailBean.getContent().getSzcgStatus() == 4 || contentDetailBean.getContent().getSzcgStatus() == 5) {
                                            invitationBean.setStatus(1);
                                        }
                                        if (contentDetailBean.getContent().getSzcgStatus() == -100) {
                                            invitationBean.setTitle("已作废");
                                            invitationBean.setStatus(1);
                                        }
                                    }
                                    invitation_adapter.add(invitationBean);
                                }
                                invitation_adapter.notifyDataSetChanged();
                            }

                            if (contentDetailBean.getContent().getLabelList() != null && contentDetailBean.getContent().getLabelList().size() != 0) {
                                if (contentDetailBean.getContent().getLabelList().size() == 1) {
                                    tab1.setVisibility(View.VISIBLE);
                                    tab2.setVisibility(View.GONE);
                                    tab1.setText(contentDetailBean.getContent().getLabelList().get(0).getName());
                                } else if (contentDetailBean.getContent().getLabelList().size() > 1) {
                                    tab1.setVisibility(View.VISIBLE);
                                    tab2.setVisibility(View.VISIBLE);
                                    tab1.setText(contentDetailBean.getContent().getLabelList().get(0).getName());
                                    tab2.setText(contentDetailBean.getContent().getLabelList().get(1).getName());
                                }
                            } else {
                                tab1.setVisibility(View.GONE);
                                tab2.setVisibility(View.GONE);
                            }

                            try {
                                float distance = LocationUtil.getInstance().calculateDistance(contentDetailBean.getContent().getLatitude(), contentDetailBean.getContent().getLongitude());
                                SpannableString address_sb = new SpannableString(contentDetailBean.getContent().getAddress().split("\\|")[0]);
                                address_sb.setSpan(color1, 0, contentDetailBean.getContent().getAddress().split("\\|")[0].length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
                                if (distance <= 100) {
                                    distace_sb = new SpannableString(" | <100m");
                                } else {
                                    distace_sb = new SpannableString(" | " + df.format(distance / 1000) + "km");
                                } /*else if (distance > 1000 && distance <= 2000) {
                                    distace_sb = new SpannableString(" | <2km");
                                } else if (distance > 2000 && distance <= 3000) {
                                    distace_sb = new SpannableString(" | <3km");
                                } else if (distance > 3000 && distance <= 4000) {
                                    distace_sb = new SpannableString(" | <4km");
                                } else if (distance > 4000 && distance <= 5000) {
                                    distace_sb = new SpannableString(" | <5km");
                                } else if (distance > 5000 && distance <= 6000) {
                                    distace_sb = new SpannableString(" | <6km");
                                } else if (distance > 6000 && distance <= 7000) {
                                    distace_sb = new SpannableString(" | <7km");
                                } else if (distance > 7000 && distance <= 8000) {
                                    distace_sb = new SpannableString(" | <8km");
                                } else if (distance > 8000 && distance <= 9000) {
                                    distace_sb = new SpannableString(" | <9km");
                                } else if (distance > 9000 && distance <= 10000) {
                                    distace_sb = new SpannableString(" | <10km");
                                } else if (distance > 10000 && distance <= 20000) {
                                    distace_sb = new SpannableString(" | <20km");
                                } else if (distance > 20000 && distance <= 30000) {
                                    distace_sb = new SpannableString(" | <30km");
                                } else if (distance > 30000 && distance <= 40000) {
                                    distace_sb = new SpannableString(" | <40km");
                                } else if (distance > 40000 && distance <= 50000) {
                                    distace_sb = new SpannableString(" | <50km");
                                } else if (distance > 50000 && distance <= 60000) {
                                    distace_sb = new SpannableString(" | <60km");
                                } else if (distance > 60000 && distance <= 70000) {
                                    distace_sb = new SpannableString(" | <70km");
                                } else if (distance > 70000 && distance <= 80000) {
                                    distace_sb = new SpannableString(" | <80km");
                                } else if (distance > 80000 && distance <= 90000) {
                                    distace_sb = new SpannableString(" | <90km");
                                } else if (distance > 90000 && distance <= 1000000) {
                                    distace_sb = new SpannableString(" | <100km");
                                } else if (distance > 100000) {
                                    distace_sb = new SpannableString(" | >100km");
                                }*/

                                distace_sb.setSpan(color2, 0, distace_sb.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
                                SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                                spannableStringBuilder.append(address_sb);
                                spannableStringBuilder.append(distace_sb);
                                location.setText(spannableStringBuilder);
                            } catch (Exception e) {
                                location.setText(contentDetailBean.getContent().getAddress().split("\\|")[0]);
                            }

                            praiseNum.setText(contentDetailBean.getContent().getLikeSum() + "");
                            commentNum.setText(contentDetailBean.getContent().getCommentSum() + "");
                            comment_count.setText("评论 "+contentDetailBean.getContent().getCommentSum());
                            shareNum.setText(contentDetailBean.getContent().getShareSum() + "");
                            watch_num.setText(contentDetailBean.getContent().getReadSum() + "");
                            if (contentDetailBean.getContent().getIsLike() == 1) {
                                praiseIv.setImageResource(R.mipmap.icon_praise_select);
                            } else {
                                praiseIv.setImageResource(R.mipmap.item_praise);
                            }
                            if (contentDetailBean.getContent().getAnonymity() == 1) {
                                name.setText("匿名用户");
                                topName.setText("匿名用户");
                                follow.setVisibility(View.INVISIBLE);
                            } else {
                                name.setText(contentDetailBean.getContent().getNickname());
                                topName.setText(contentDetailBean.getContent().getNickname());
                                if (mUserInfoBean != null) {
                                    if (mUserInfoBean.getUser().getUserId() == contentDetailBean.getContent().getUserId()) {
                                        follow.setVisibility(View.INVISIBLE);
                                    } else {
                                        if (contentDetailBean.getContent().getIsAttention() == 1) {
                                            follow.setVisibility(View.INVISIBLE);
                                        } else {
                                            follow.setVisibility(View.VISIBLE);
                                        }
                                    }
                                } else {
                                    if (contentDetailBean.getContent().getIsAttention() == 1) {
                                        follow.setVisibility(View.INVISIBLE);
                                    } else {
                                        follow.setVisibility(View.VISIBLE);
                                    }
                                }
                            }
                            timecha(contentDetailBean.getContent().getCreateTime(), time);

                            if (!TextUtils.isEmpty(flag)) {
                                if (flag.equals("comment") && !isFirst) {
                                    isFirst = true;
                                    new Handler().postDelayed(new Runnable() {
                                        @Override
                                        public void run() {
                                            scrollView.scrollTo(0, relative.getTop());
                                        }
                                    }, 1500);
                                }
                            }

                        } else {
                            empty_rl.setVisibility(View.VISIBLE);
                            if (contentDetailBean.getCode() == Contacts.TOKEN_EMPTY) {
                            } else {
                                if (!"没有找到该内容".equals(contentDetailBean.getMsg())) {
                                    showImageToas(contentDetailBean.getMsg());
                                }
                            }
                        }
                    }


                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        dismissDialog();
                        empty_rl.setVisibility(View.VISIBLE);
                    }
                });
            }
        });


    }

    private void deleteComment(CommentListBean.PageBean.ListBean item, String flag) {
        DialogUtil.getInstance().showCenterDialog(context, R.layout.dialog_more);
        LinearLayout dialog_more = (LinearLayout) DialogUtil.getInstance().dialog_center_layout;
        LinearLayout cancel_follow = dialog_more.findViewById(R.id.cancel_follow);
        LinearLayout delete = dialog_more.findViewById(R.id.delete);
        LinearLayout report = dialog_more.findViewById(R.id.report);
        LinearLayout black_list = dialog_more.findViewById(R.id.black_list);
        LinearLayout receive = dialog_more.findViewById(R.id.receive);

        TextView delete_tv = dialog_more.findViewById(R.id.delete_tv);
        TextView report_tv = dialog_more.findViewById(R.id.report_tv);

        delete_tv.setText("删除该评论");
        report_tv.setText("举报该评论");

        View line = dialog_more.findViewById(R.id.line);
        View viewline = dialog_more.findViewById(R.id.view);
        View view1 = dialog_more.findViewById(R.id.view1);
        View view2 = dialog_more.findViewById(R.id.view2);

        if (flag.equals("delete_report")) {
            report.setVisibility(View.VISIBLE);
            black_list.setVisibility(View.GONE);
            cancel_follow.setVisibility(View.GONE);
            line.setVisibility(View.GONE);
            viewline.setVisibility(View.GONE);
            view1.setVisibility(View.VISIBLE);
            delete.setVisibility(View.VISIBLE);
            view2.setVisibility(View.VISIBLE);
            receive.setVisibility(View.VISIBLE);
        } else if ("report".equals(flag)) {
            report.setVisibility(View.VISIBLE);
            black_list.setVisibility(View.GONE);
            cancel_follow.setVisibility(View.GONE);
            line.setVisibility(View.GONE);
            viewline.setVisibility(View.GONE);
            view1.setVisibility(View.INVISIBLE);
            delete.setVisibility(View.GONE);
            view2.setVisibility(View.VISIBLE);
            receive.setVisibility(View.VISIBLE);
        } else {
            report.setVisibility(View.GONE);
            black_list.setVisibility(View.GONE);
            cancel_follow.setVisibility(View.GONE);
            line.setVisibility(View.GONE);
            viewline.setVisibility(View.GONE);
            view1.setVisibility(View.INVISIBLE);
            delete.setVisibility(View.VISIBLE);
            view2.setVisibility(View.VISIBLE);
            receive.setVisibility(View.VISIBLE);
        }

        receive.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (Utils.isDoubleClick()) {
                    return;
                }
                DialogUtil.getInstance().dialog_center.dismiss();
                replyUserId = item.getUserId() + "";
                replyCommentId = item.getId() + "";
                et_flag = "receive";
                if (item.getUserId() == mContentDetailBean.getContent().getUserId()) {
                    if (mContentDetailBean.getContent().getAnonymity() == 1) {
                        replayName = "匿名用户";
                        replayContent = item.getComment();
                    } else {
                        replayName = item.getNickname();
                        replayContent = item.getComment();
                    }
                } else {
                    replayName = item.getNickname();
                    replayContent = item.getComment();
                }
                tokenVerify();
            }
        });

        report.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (Utils.isDoubleClick()) {
                    return;
                }
                DialogUtil.getInstance().dialog_center.dismiss();
                Bundle bundle = new Bundle();
                bundle.putString("flag", "report");
                bundle.putString("contentId", mContentDetailBean.getContent().getId() + "");
                bundle.putString("module", "1");
                bundle.putString("type", "2");
                bundle.putString("byUserId", item.getUserId() + "");
                bundle.putString("commentId", item.getId() + "");
                startActivity(ReportActivity.class, bundle);
            }
        });

        delete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (Utils.isDoubleClick()) {
                    return;
                }
                DialogUtil.getInstance().dialog_center.dismiss();
                showDialog(context, "删除中...");
                HttpParams params = new HttpParams();
                params.put("commentId", item.getId());
                finalOkGo.requestHead(RequestType.POSTHEAD, Url.DELETE_COMMENT, params, Url.DELETE_COMMENT, new Callback<SendCodeBean>() {
                    @Override
                    public void onSuccess(SendCodeBean sendCodeBean) {
                        dismissDialog();
                        if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                            mContentDetailBean.getContent().setCommentSum(mContentDetailBean.getContent().getCommentSum() - 1);
                            commentNum.setText(mContentDetailBean.getContent().getCommentSum() + "");
                            comment_count.setText("评论 "+mContentDetailBean.getContent().getCommentSum());
                            quickAdapter.remove(item);
                            quickAdapter.notifyDataSetChanged();
                        } else {
                            if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                            } else {
                                showImageToas(sendCodeBean.getMsg());
                            }
                        }
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        dismissDialog();
                    }
                });
            }
        });
    }


    private long formattingtime;
    private long TimeCha;

    private void timecha(String startime, TextView textView) {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat dataformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long currenttime = calendar.getTimeInMillis();//获取系统当先时间的毫秒值
        try {//如果你的初始时间是格式化过的,则需要先转化成毫秒值
            formattingtime = dataformat.parse(startime).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
//这里需要注意,因为获取的时间因为时差的缘故已经自动加上了8小时的时间,所以这里需要减去.如果不减去,就算是你刚刚发布的动态也会显示是8小时之前
        TimeCha = ((currenttime - formattingtime) / 1000) /*- (8 * 60 * 60)*/;//将毫秒值转化成分钟数
//        Logger.e(TimeCha+"");
        if (TimeCha < 60) {
            textView.setText("刚刚");
        } else if (TimeCha >= 60 && TimeCha < 3600) {
            textView.setText(TimeCha / 60 + "分钟前");
        } else if (TimeCha >= 3600 && TimeCha < 3600 * 24) {
            textView.setText(TimeCha / 3600 + "小时前");
        } else if (TimeCha >= 3600 * 1 * 24 && TimeCha < 3600 * 31 * 24) {
            textView.setText(TimeCha / 3600 / 24 + "天前");
        } else if (TimeCha >= 3600 * 31 * 24 * 1 && TimeCha < 3600 * 31 * 24 * 12) {
            textView.setText(TimeCha / 3600 / 24 / 30 + "个月前");
        } else {
            textView.setText(TimeCha / 3600 / 24 / 30 / 12 + "年前");
        }
    }


    private void requestComment() {
        HttpParams params = new HttpParams();
        params.put("contentId", id);
        params.put("type", 1);
        if (mUserInfoBean != null) {
            params.put("userId", mUserInfoBean.getUser().getUserId());
        }
        params.put("position", 1);
        params.put("limit", pageSize);
        params.put("page", pageNum++);
        finalOkGo.request(RequestType.POST, Url.GET_COMMENT_LIST, params, Url.GET_COMMENT_LIST, new Callback<CommentListBean>() {
            @Override
            public void onSuccess(CommentListBean commentListBean) {
                dismissDialog();
                if (commentListBean.getCode() == Contacts.SUCCESS) {
                    if (pageNum - 1 == 1) {
                        quickAdapter.clear();
                        quickAdapter.addAll(commentListBean.getPage().getList());
                    } else {
                        quickAdapter.addAll(commentListBean.getPage().getList());
                    }

                    refreshLayout.finishRefresh();
                    refreshLayout.finishLoadMore();
                    quickAdapter.notifyDataSetChanged();

                    int pagecount;
                    if (commentListBean.getPage().getTotalCount() % pageSize == 0) {
                        pagecount = commentListBean.getPage().getTotalCount() / pageSize;
                    } else {
                        pagecount = commentListBean.getPage().getTotalCount() / pageSize + 1;
                    }

                    if (pageNum > pagecount) {
                        refreshLayout.setNoMoreData(true);
                        refreshLayout.finishLoadMoreWithNoMoreData();
                    } else {
                        refreshLayout.setNoMoreData(false);
                    }

                } else {
                    refreshLayout.finishRefresh();
                    refreshLayout.finishLoadMore();
                    if (commentListBean.getCode() == Contacts.TOKEN_EMPTY) {
                    } else {
                        showImageToas(commentListBean.getMsg());
                    }
                }
            }

            @Override
            public void onError(Response<String> response) {
                super.onError(response);
                dismissDialog();
                refreshLayout.finishRefresh();
                refreshLayout.finishLoadMore();
            }
        });
    }

    @Override
    public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
        requestComment();
    }

    @Override
    public void onRefresh(@NonNull RefreshLayout refreshLayout) {
        pageNum = 1;
        initData();
    }

    //    @Override
    @OnClick({R.id.comment_et, R.id.top_title, R.id.detail_more, R.id.name, R.id.follow, R.id.head_rl, R.id.praise, R.id.comment, R.id.share, R.id.add, R.id.send/*, R.id.fragment_container*/})
    public void onViewClicked(View view) {
//        super.onViewClicked(view);
        if (Utils.isDoubleClick()) {
            return;
        }
        switch (view.getId()) {
            case R.id.top_title:
                if (mContentDetailBean != null) {
                    if (mContentDetailBean.getContent().getAnonymity() != 1) {
                        Bundle bundle = new Bundle();
                        bundle.putString("userId", mContentDetailBean.getContent().getUserId() + "");
                        startActivity(OtherInfoActivity.class, bundle);
                    } else {
                        showImageToas("匿名用户无法查看主页");
                    }
                }
                break;
            case R.id.detail_more:
                if (mContentDetailBean != null) {
                    showDialog(context, null);
                    JSONObject jsonObject2 = new JSONObject();
                    try {
                        jsonObject2.put("contentId", mContentDetailBean.getContent().getId());
                        jsonObject2.put("module", 1);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_DATA, null, jsonObject2.toString(), new Callback<ShareDataBean>() {
                        @Override
                        public void onSuccess(ShareDataBean shareDataBean) {
                            dismissDialog();
                            if (shareDataBean.getCode() == Contacts.SUCCESS) {
                                showShareDialog(shareDataBean, "more");
                            } else {
                                if (shareDataBean.getCode() == Contacts.TOKEN_EMPTY) {
                                } else {
                                    showImageToas(shareDataBean.getMsg());
                                }
                            }

                        }

                        @Override
                        public void onError(Response<String> response) {
                            super.onError(response);
                            dismissDialog();
                        }
                    });
                } else {

                }

                break;
            case R.id.name:
                if (mContentDetailBean != null) {
                    if (mContentDetailBean.getContent().getAnonymity() != 1) {
                        Bundle bundle1 = new Bundle();
                        bundle1.putString("userId", mContentDetailBean.getContent().getUserId() + "");
                        startActivity(OtherInfoActivity.class, bundle1);
                    } else {
                        showImageToas("匿名用户无法查看主页");
                    }
                }
                break;
            case R.id.follow:
                showDialog(context, "关注中...");
                if (mContentDetailBean != null) {
                    finalOkGo.requestHead(RequestType.GETHEAD, Url.FOLLOW_OTHER + mContentDetailBean.getContent().getUserId(), null, Url.FOLLOW_OTHER, new Callback<SendCodeBean>() {
                        @Override
                        public void onSuccess(SendCodeBean sendCodeBean) {
                            dismissDialog();
                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                mContentDetailBean.getContent().setIsAttention(1);
                                follow.setVisibility(View.INVISIBLE);
                                EventBus.getDefault().post("refresh_home_data");
                                EventBus.getDefault().post("refresh_mine");
                            } else {
                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                } else {
                                    showImageToas(sendCodeBean.getMsg());
                                }
                            }
                        }

                        @Override
                        public void onError(Response<String> response) {
                            super.onError(response);
                            dismissDialog();
                        }
                    });
                }
                break;
            case R.id.head_rl:
                if (mContentDetailBean != null) {
                    if (mContentDetailBean.getContent().getAnonymity() != 1) {
                        Bundle bundle2 = new Bundle();
                        bundle2.putString("userId", mContentDetailBean.getContent().getUserId() + "");
                        startActivity(OtherInfoActivity.class, bundle2);
                    } else {
                        showImageToas("匿名用户无法查看主页");
                    }
                }
                break;
            case R.id.praise:
                if (mContentDetailBean != null) {
                    if (mContentDetailBean.getContent().getIsLike() == 1) {
                        praise.setEnabled(false);
                        showDialog(context, "取消中...");
                        JSONObject jsonObject = new JSONObject();
                        try {
                            jsonObject.put("contentId", mContentDetailBean.getContent().getId());
                            jsonObject.put("module", 1);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.CANCEL_PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                            @Override
                            public void onSuccess(SendCodeBean sendCodeBean) {
                                dismissDialog();
                                praise.setEnabled(true);
                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                    mContentDetailBean.getContent().setIsLike(0);
                                    mContentDetailBean.getContent().setLikeSum(mContentDetailBean.getContent().getLikeSum() - 1);
                                    praiseNum.setText(mContentDetailBean.getContent().getLikeSum() + "");
                                    praiseIv.setImageResource(R.mipmap.item_praise);
                                    EventBus.getDefault().post("refresh_home_data");
                                    EventBus.getDefault().post("refresh_mine");
                                } else {
                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                    } else {
                                        showImageToas(sendCodeBean.getMsg());
                                    }
                                }
                            }

                            @Override
                            public void onError(Response<String> response) {
                                super.onError(response);
                                dismissDialog();
                            }
                        });
                    } else {
                        praise.setEnabled(false);
                        showDialog(context, "点赞中...");
                        JSONObject jsonObject = new JSONObject();
                        try {
                            jsonObject.put("contentId", mContentDetailBean.getContent().getId());
                            jsonObject.put("module", 1);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.PRAISE_HOME, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                            @Override
                            public void onSuccess(SendCodeBean sendCodeBean) {
                                dismissDialog();
                                praise.setEnabled(true);
                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                    mContentDetailBean.getContent().setIsLike(1);
                                    mContentDetailBean.getContent().setLikeSum(mContentDetailBean.getContent().getLikeSum() + 1);
                                    praiseNum.setText(mContentDetailBean.getContent().getLikeSum() + "");
                                    praiseIv.setImageResource(R.mipmap.icon_praise_select);
                                    EventBus.getDefault().post("refresh_home_data");
                                    EventBus.getDefault().post("refresh_mine");
                                } else {
                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                    } else {
                                        showImageToas(sendCodeBean.getMsg());
                                    }
                                }
                            }

                            @Override
                            public void onError(Response<String> response) {
                                super.onError(response);
                                dismissDialog();
                                praise.setEnabled(true);
                            }
                        });
                    }
                }
                break;
            case R.id.comment:
                et_flag = "comment";
                replayName = "";
                replayContent = "";
                tokenVerify();
                break;
            case R.id.share:
                if (mContentDetailBean != null) {
                    showDialog(context, null);
                    JSONObject jsonObject1 = new JSONObject();
                    try {
                        jsonObject1.put("contentId", mContentDetailBean.getContent().getId());
                        jsonObject1.put("module", 1);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_DATA, null, jsonObject1.toString(), new Callback<ShareDataBean>() {
                        @Override
                        public void onSuccess(ShareDataBean shareDataBean) {
                            dismissDialog();
                            if (shareDataBean.getCode() == Contacts.SUCCESS) {
                                showShareDialog(shareDataBean, "share");
                            } else {
                                if (shareDataBean.getCode() == Contacts.TOKEN_EMPTY) {
                                } else {
                                    showImageToas(shareDataBean.getMsg());
                                }
                            }

                        }

                        @Override
                        public void onError(Response<String> response) {
                            super.onError(response);
                            dismissDialog();
                        }
                    });
                }
                break;
            case R.id.add:
                break;
            case R.id.send:
                et_flag = "comment";
                replayName = "";
                replayContent = "";
                tokenVerify();
                break;
            case R.id.comment_et:
                et_flag = "comment";
                replayName = "";
                replayContent = "";
                tokenVerify();
                break;
        }
    }

    @Override
    public String getCommentText() {
        return comment_et.getText().toString();
    }

    @Override
    public String getReplayName() {
        return replayName;
    }

    @Override
    public String getReplayContent() {
        return replayContent;
    }

    @Override
    public void setCommentText(String commentTextTemp) {
        if (!TextUtils.isEmpty(commentTextTemp)) {
            comment_et.setRichText(commentTextTemp);
        } else {
            comment_et.setText(commentTextTemp);
        }
    }

    @Override
    public List<UserModel> getNameList() {
        for (int i = 0; i < comment_et.getNameList().size(); i++) {
            comment_et.getNameList().get(i).setUser_name("@" + comment_et.getNameList().get(i).getUser_name());
        }
        return comment_et.getNameList();
    }

    @Override
    public void setNameList(List<UserModel> nameList) {
        comment_et.setNameList(nameList);
    }

    @Override
    protected void onPause() {
        super.onPause();
        if (videoView != null) {
            videoView.pause();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (videoView != null) {
            videoView.setMute(true);
            videoView.resume();
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
        if (videoView != null) {
            removePlayerFormParent(videoView);
            //移除Controller
            videoView.setVideoController(null);
            mPreloadManager.removeAllPreloadTask();
        }
        if (VideoPraiseHashMap.getIntance() != null) {
            VideoPraiseHashMap.getIntance().clear();
        }
    }

    @Subscribe(threadMode = ThreadMode.POSTING, sticky = true)
    public void OnMessageEvent(String event) {
        String s = event.split(":")[0];
        if (s.equals("comment_detial_add")) {
            mContentDetailBean.getContent().setCommentSum(mContentDetailBean.getContent().getCommentSum() + 1);
            commentNum.setText(mContentDetailBean.getContent().getCommentSum() + "");
            comment_count.setText("评论 "+mContentDetailBean.getContent().getCommentSum());
            pageNum = 1;
            initData();
        } else if (s.equals("comment_detial_sub")) {
            mContentDetailBean.getContent().setCommentSum(mContentDetailBean.getContent().getCommentSum() - 1);
            commentNum.setText(mContentDetailBean.getContent().getCommentSum() + "");
            comment_count.setText("评论 "+mContentDetailBean.getContent().getCommentSum());
            pageNum = 1;
            initData();
        } else if (s.equals("comment_detial_praise")) {
            mContentDetailBean.getContent().setIsLike(1);
            mContentDetailBean.getContent().setLikeSum(mContentDetailBean.getContent().getLikeSum() + 1);
            praiseNum.setText(mContentDetailBean.getContent().getLikeSum() + "");
            praiseIv.setImageResource(R.mipmap.icon_praise_select);
        } else if (s.equals("comment_detial_cancel_praise")) {
            mContentDetailBean.getContent().setIsLike(0);
            mContentDetailBean.getContent().setLikeSum(mContentDetailBean.getContent().getLikeSum() - 1);
            praiseNum.setText(mContentDetailBean.getContent().getLikeSum() + "");
            praiseIv.setImageResource(R.mipmap.item_praise);
        } else if (s.equals("refresh_praise_comment_count")) {
            for (int i = 0; i < quickAdapter.getCount(); i++) {
                if ((quickAdapter.getItem(i).getId() + "").equals(event.split(":")[1])) {
                    quickAdapter.getItem(i).setIsLike(1);
                    quickAdapter.getItem(i).setLikeSum(quickAdapter.getItem(i).getLikeSum() + 1);
                    quickAdapter.notifyDataSetChanged();
                }
            }
        } else if (s.equals("refresh_cancel_praise_comment_count")) {
            for (int i = 0; i < quickAdapter.getCount(); i++) {
                if ((quickAdapter.getItem(i).getId() + "").equals(event.split(":")[1])) {
                    quickAdapter.getItem(i).setIsLike(0);
                    quickAdapter.getItem(i).setLikeSum(quickAdapter.getItem(i).getLikeSum() - 1);
                    quickAdapter.notifyDataSetChanged();
                }
            }
        } else if (s.equals("ByIdDetailActivity_comment")) {
            if (!TextUtils.isEmpty(comment_et.getText().toString().trim())) {
                if (et_flag.equals("comment")) {
                    showDialog(context, "评论中...");
                    JSONObject jsonObject = new JSONObject();
                    JSONArray jsonArray = new JSONArray();
                    try {
                        for (int i = 0; i < comment_et.getNameList().size(); i++) {
                            JSONObject userJson = new JSONObject();
                            userJson.put("userId", comment_et.getNameList().get(i).getUser_id());
                            userJson.put("nickname", comment_et.getNameList().get(i).getUser_name());
                            jsonArray.put(userJson);
                        }
                        jsonObject.put("remindJson", jsonArray.toString());
                        jsonObject.put("contentId", mContentDetailBean.getContent().getId());
                        jsonObject.put("comment", comment_et.getText().toString().trim());
                        jsonObject.put("position", 1);
                        jsonObject.put("type", 1);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.COMMENT_SAVE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                        @Override
                        public void onSuccess(SendCodeBean sendCodeBean) {
                            dismissDialog();
                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                EventBus.getDefault().post("refresh_comment_mine");
                                EventBus.getDefault().post("refresh_home_data");
                                EventBus.getDefault().post("refresh_mine");
                                replayName = "";
                                replayContent = "";
                                mContentDetailBean.getContent().setCommentSum(mContentDetailBean.getContent().getCommentSum() + 1);
                                commentNum.setText(mContentDetailBean.getContent().getCommentSum() + "");
                                comment_count.setText("评论 "+mContentDetailBean.getContent().getCommentSum());
//                                pageNum = 1;
//                                initData();
                                List<CommentListBean.PageBean.ListBean> commentList = new ArrayList<>();
                                for (int i = 0; i < quickAdapter.getCount(); i++) {
                                    commentList.add(quickAdapter.getItem(i));
                                }
                                CommentListBean.PageBean.ListBean bean = new CommentListBean.PageBean.ListBean();
                                bean.setId(sendCodeBean.getCommentId());
                                bean.setComment(comment_et.getText().toString().trim());
                                bean.setContentId(mContentDetailBean.getContent().getId());
                                bean.setPosition(1);
                                bean.setType(1);
                                bean.setRemindJson(jsonArray.toString());
                                bean.setCreateTime(DateFormatUtil.ms4Date(System.currentTimeMillis()));
                                bean.setAvatar(mUserInfoBean.getUser().getAvatar());
                                bean.setNickname(mUserInfoBean.getUser().getNickname());
                                bean.setUserId(mUserInfoBean.getUser().getUserId());
                                quickAdapter.clear();
                                quickAdapter.add(bean);
                                quickAdapter.addAll(commentList);
                                comment_et.setText("");
                                scrollView.scrollTo(0, relative.getTop());
                            } else {
                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                } else {
                                    showImageToas(sendCodeBean.getMsg());
                                }
                            }
                        }

                        @Override
                        public void onError(Response<String> response) {
                            super.onError(response);
                            dismissDialog();
                        }
                    });
                } else {
                    showDialog(context, "评论中...");
                    JSONObject jsonObject = new JSONObject();
                    JSONArray jsonArray = new JSONArray();
                    try {
                        for (int i = 0; i < comment_et.getNameList().size(); i++) {
                            JSONObject userJson = new JSONObject();
                            userJson.put("userId", comment_et.getNameList().get(i).getUser_id());
                            userJson.put("nickname", comment_et.getNameList().get(i).getUser_name());
                            jsonArray.put(userJson);
                        }
                        jsonObject.put("remindJson", jsonArray.toString());
                        jsonObject.put("contentId", mContentDetailBean.getContent().getId());
                        jsonObject.put("comment", comment_et.getText().toString().trim());
                        jsonObject.put("replyUserId", replyUserId);
                        jsonObject.put("replyCommentId", replyCommentId);
                        jsonObject.put("position", 2);
                        jsonObject.put("type", 1);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.COMMENT_SAVE, null, jsonObject.toString(), new Callback<SendCodeBean>() {
                        @Override
                        public void onSuccess(SendCodeBean sendCodeBean) {
                            dismissDialog();
                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                EventBus.getDefault().post("refresh_comment_mine");
                                EventBus.getDefault().post("refresh_home_data");
                                EventBus.getDefault().post("refresh_mine");
                                et_flag = "comment";
                                replayName = "";
                                replayContent = "";
                                if (quickAdapter.getItem(replyPosition).getLowerComment() == null) {
                                    quickAdapter.getItem(replyPosition).setLowerComment(new LinkedList<CommentListBean.PageBean.ListBean.LowerCommentBean>());
                                }
                                CommentListBean.PageBean.ListBean.LowerCommentBean lowerCommentBean = new CommentListBean.PageBean.ListBean.LowerCommentBean();
                                lowerCommentBean.setComment(comment_et.getText().toString().trim());
                                lowerCommentBean.setContentId(mContentDetailBean.getContent().getId());
                                lowerCommentBean.setRemindJson(jsonArray.toString());
                                lowerCommentBean.setReplyUserId(Integer.parseInt(replyUserId));
                                lowerCommentBean.setReplyCommentId(Integer.parseInt(replyCommentId));
                                lowerCommentBean.setNickname(mUserInfoBean.getUser().getNickname());
                                lowerCommentBean.setReplyNickname(quickAdapter.getItem(replyPosition).getNickname());
                                lowerCommentBean.setUserId(mUserInfoBean.getUser().getUserId());
                                lowerCommentBean.setReplyUserId(quickAdapter.getItem(replyPosition).getUserId());
                                if (quickAdapter.getItem(replyPosition).getLowerComment().size() >= 2) {
                                    quickAdapter.getItem(replyPosition).getLowerComment().set(0, lowerCommentBean);
                                } else {
                                    quickAdapter.getItem(replyPosition).getLowerComment().addFirst(lowerCommentBean);
                                }
                                quickAdapter.getItem(replyPosition).setCommentSum(quickAdapter.getItem(replyPosition).getCommentSum() + 1);
                                quickAdapter.notifyDataSetChanged();
                                comment_et.setText("");
                            } else {
                                showImageToas(sendCodeBean.getMsg());
                            }
                        }

                        @Override
                        public void onError(Response<String> response) {
                            super.onError(response);
                            dismissDialog();
                        }
                    });
                }
            } else {
//                showImageToas("请填写点内容吧");
            }
        } else if (s.equals("replay_search")) {
            container1.removeAllViews();
            container2.removeAllViews();
            videoView = VideoPraiseHashMap.getIntance().get(mContentDetailBean.getContent().getId());
            removePlayerFormParent(videoView);
            standardVideoController = new StandardVideoController(this);
            videoView.setVideoController(standardVideoController);
            videoView.setScreenScaleType(VideoView.SCREEN_SCALE_CENTER_CROP);
            standardVideoController.setPlayState(videoView.getCurrentPlayState());
            standardVideoController.setPlayerState(videoView.getCurrentPlayerState());
            videoView.setMute(true);

            standardVideoController.getThumb().setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (Utils.isDoubleClick()) {
                        return;
                    }
                    Bundle bundle1 = new Bundle();
                    VideoListBean videoListBean = new VideoListBean();
                    videoListBean.setVideoDownloadUrl(mContentDetailBean.getContent().getUrls());
                    videoListBean.setCoverImgUrl(mContentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                    videoListBean.setTitle(mContentDetailBean.getContent().getTitle());
                    videoListBean.setComment_num(mContentDetailBean.getContent().getCommentSum());
                    videoListBean.setPraise_num(mContentDetailBean.getContent().getLikeSum());
                    videoListBean.setHeadPhoto(mContentDetailBean.getContent().getAvatar());
                    videoListBean.setNickName(mContentDetailBean.getContent().getNickname());
                    videoListBean.setTime(mContentDetailBean.getContent().getCreateTime());
                    videoListBean.setIsLike(mContentDetailBean.getContent().getIsLike());
                    videoListBean.setAnonymity(mContentDetailBean.getContent().getAnonymity());
                    videoListBean.setUserId(mContentDetailBean.getContent().getUserId());
                    videoListBean.setContentId(mContentDetailBean.getContent().getId());
                    List<RemindJson> remindJsons = GsonUtil.jsonToList(mContentDetailBean.getContent().getRemindJson(), RemindJson.class);
                    videoListBean.setList(remindJsons);
                    bundle1.putSerializable("data", videoListBean);
                    bundle1.putInt("videoId", mContentDetailBean.getContent().getId());
                    bundle1.putString("flag", "praise");
                    bundle1.putString("categoriesId", mContentDetailBean.getContent().getCategoriesId() + "");
                    bundle1.putInt("position", 0);
                    startActivity(VideoDetailActivity.class, bundle1);
                }
            });

            standardVideoController.findViewById(R.id.start_play).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (Utils.isDoubleClick()) {
                        return;
                    }
                    Bundle bundle1 = new Bundle();
                    VideoListBean videoListBean = new VideoListBean();
                    videoListBean.setVideoDownloadUrl(mContentDetailBean.getContent().getUrls());
                    videoListBean.setCoverImgUrl(mContentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                    videoListBean.setTitle(mContentDetailBean.getContent().getTitle());
                    videoListBean.setComment_num(mContentDetailBean.getContent().getCommentSum());
                    videoListBean.setPraise_num(mContentDetailBean.getContent().getLikeSum());
                    videoListBean.setHeadPhoto(mContentDetailBean.getContent().getAvatar());
                    videoListBean.setNickName(mContentDetailBean.getContent().getNickname());
                    videoListBean.setTime(mContentDetailBean.getContent().getCreateTime());
                    videoListBean.setIsLike(mContentDetailBean.getContent().getIsLike());
                    videoListBean.setAnonymity(mContentDetailBean.getContent().getAnonymity());
                    videoListBean.setUserId(mContentDetailBean.getContent().getUserId());
                    videoListBean.setContentId(mContentDetailBean.getContent().getId());
                    List<RemindJson> remindJsons = GsonUtil.jsonToList(mContentDetailBean.getContent().getRemindJson(), RemindJson.class);
                    videoListBean.setList(remindJsons);
                    bundle1.putSerializable("data", videoListBean);
                    bundle1.putInt("videoId", mContentDetailBean.getContent().getId());
                    bundle1.putString("flag", "praise");
                    bundle1.putString("categoriesId", mContentDetailBean.getContent().getCategoriesId() + "");
                    bundle1.putInt("position", 0);
                    startActivity(VideoDetailActivity.class, bundle1);
                }
            });

            standardVideoController.setOnClickListener(view12 -> {
                if (Utils.isDoubleClick()) {
                    return;
                }
                Bundle bundle1 = new Bundle();
                VideoListBean videoListBean = new VideoListBean();
                videoListBean.setVideoDownloadUrl(mContentDetailBean.getContent().getUrls());
                videoListBean.setCoverImgUrl(mContentDetailBean.getContent().getUrls() + "?vframe/jpg/offset/1");
                videoListBean.setTitle(mContentDetailBean.getContent().getTitle());
                videoListBean.setComment_num(mContentDetailBean.getContent().getCommentSum());
                videoListBean.setPraise_num(mContentDetailBean.getContent().getLikeSum());
                videoListBean.setHeadPhoto(mContentDetailBean.getContent().getAvatar());
                videoListBean.setNickName(mContentDetailBean.getContent().getNickname());
                videoListBean.setTime(mContentDetailBean.getContent().getCreateTime());
                videoListBean.setIsLike(mContentDetailBean.getContent().getIsLike());
                videoListBean.setAnonymity(mContentDetailBean.getContent().getAnonymity());
                videoListBean.setUserId(mContentDetailBean.getContent().getUserId());
                videoListBean.setContentId(mContentDetailBean.getContent().getId());
                List<RemindJson> remindJsons = GsonUtil.jsonToList(mContentDetailBean.getContent().getRemindJson(), RemindJson.class);
                videoListBean.setList(remindJsons);
                bundle1.putSerializable("data", videoListBean);
                bundle1.putInt("videoId", mContentDetailBean.getContent().getId());
                bundle1.putString("flag", "praise");
                bundle1.putString("categoriesId", mContentDetailBean.getContent().getCategoriesId() + "");
                bundle1.putInt("position", 0);
                startActivity(VideoDetailActivity.class, bundle1);
            });

            if (container1.getVisibility() == View.VISIBLE) {
                container1.addView(videoView);
            } else {
                container2.addView(videoView);
            }
        }
    }

    private void showShareDialog(ShareDataBean shareDataBean, String flag) {

        DialogUtil.getInstance().showBottomDialog(context, R.layout.dialog_share);
        LinearLayout dialog_share = (LinearLayout) DialogUtil.getInstance().dialog_bottom_layout;
        dialog_share.findViewById(R.id.close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (Utils.isDoubleClick()) {
                    return;
                }
                DialogUtil.getInstance().dialog_bottom.dismiss();
            }
        });

        dialog_share.findViewById(R.id.share_wechat).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            share_flag = "weixin";
            WXShareUtil wxShareUtil = new WXShareUtil(context);
            wxShareUtil.registerWx();
            WechatLoginUtil.getInstance().setWechatCallBack(ByIdDetailActivity.this);
            String url = "";
            if (shareDataBean.getContent().getType() == 1) {
                url = shareDataBean.getContent().getUrls() + "?vframe/jpg/offset/1";
            } else if (shareDataBean.getContent().getType() == 2) {
                url = shareDataBean.getContent().getUrls().split("\\|")[0] + "?imageView2/2/w/100";
            } else if (shareDataBean.getContent().getType() == 3) {
                url = "";
            }
            wxShareUtil.share(shareDataBean.getUrl(),
                    shareDataBean.getContent().getTitle(),
                    "",
                    url, wxShareUtil.SHARETOFRIEND);
        });

        dialog_share.findViewById(R.id.share_wechat_friend).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            share_flag = "weixin";
            WXShareUtil wxShareUtil = new WXShareUtil(context);
            wxShareUtil.registerWx();
            WechatLoginUtil.getInstance().setWechatCallBack(ByIdDetailActivity.this);
            String url = "";
            if (shareDataBean.getContent().getType() == 1) {
                url = shareDataBean.getContent().getUrls() + "?vframe/jpg/offset/1";
            } else if (shareDataBean.getContent().getType() == 2) {
                url = shareDataBean.getContent().getUrls().split("\\|")[0] + "?imageView2/2/w/100";
            } else if (shareDataBean.getContent().getType() == 3) {
                url = "";
            }
            wxShareUtil.share(shareDataBean.getUrl(),
                    shareDataBean.getContent().getTitle(),
                    "",
                    url, wxShareUtil.SHARETOPYQ);
        });

        dialog_share.findViewById(R.id.share_qq).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            share_flag = "qq";
            String url = "";
            if (shareDataBean.getContent().getType() == 1) {
                url = shareDataBean.getContent().getUrls() + "?vframe/jpg/offset/1";
            } else if (shareDataBean.getContent().getType() == 2) {
                url = shareDataBean.getContent().getUrls().split("\\|")[0] + "?imageView2/2/w/100";
            } else if (shareDataBean.getContent().getType() == 3) {
                url = "";
            }
            mTencent = Tencent.createInstance(Config.QQ_APP_ID, ContextUtil.getContext());
            Bundle params = new Bundle();
            params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT);
            params.putString(QQShare.SHARE_TO_QQ_TITLE, shareDataBean.getContent().getTitle());
            params.putString(QQShare.SHARE_TO_QQ_SUMMARY, "");
            params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, url);
            params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, shareDataBean.getUrl());
            mTencent.shareToQQ(ByIdDetailActivity.this, params, new BaseUiListener());
            shareSuccess();
        });

        dialog_share.findViewById(R.id.share_qq_space).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            share_flag = "qq";
            String url = "";
            if (shareDataBean.getContent().getType() == 1) {
                url = shareDataBean.getContent().getUrls() + "?vframe/jpg/offset/1";
            } else if (shareDataBean.getContent().getType() == 2) {
                url = shareDataBean.getContent().getUrls().split("\\|")[0] + "?imageView2/2/w/100";
            } else if (shareDataBean.getContent().getType() == 3) {
                url = "";
            }
            mTencent = Tencent.createInstance(Config.QQ_APP_ID, context);
            Bundle params = new Bundle();
            params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
            params.putString(QzoneShare.SHARE_TO_QQ_TITLE, shareDataBean.getContent().getTitle());//选填
            params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, "");
            params.putString(QzoneShare.SHARE_TO_QQ_IMAGE_URL, url);
            params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, shareDataBean.getUrl());
            params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, new ArrayList<String>());
            mTencent.shareToQzone(ByIdDetailActivity.this, params, new BaseUiListener());
            shareSuccess();
        });

        dialog_share.findViewById(R.id.share_weibo).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            share_flag = "weibo";
            WbSdk.install(ContextUtil.getContext(), new AuthInfo(ContextUtil.getContext(), Config.SINA_APP_KEY, Config.REDIRECT_URL, ""));
            shareHandler = new WbShareHandler(ByIdDetailActivity.this);
            shareHandler.registerApp();
            WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
            weiboMessage.textObject = getTextObj(shareDataBean.getUrl(), shareDataBean.getContent().getTitle());
            shareHandler.shareMessage(weiboMessage, false);
            shareSuccess();
        });

        dialog_share.findViewById(R.id.copy_link).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            // 创建一个剪贴数据集，包含一个普通文本数据条目（需要复制的数据）
            ClipData clipData = ClipData.newPlainText(null, shareDataBean.getUrl());
            // 把数据集设置（复制）到剪贴板
            clipboard.setPrimaryClip(clipData);
            showToast("链接已复制");
        });

        dialog_share.findViewById(R.id.copy_text).setOnClickListener(view -> {
            if (Utils.isDoubleClick()) {
                return;
            }
            DialogUtil.getInstance().dialog_bottom.dismiss();
            ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            // 创建一个剪贴数据集，包含一个普通文本数据条目（需要复制的数据）
            ClipData clipData = ClipData.newPlainText(null, shareDataBean.getContent().getTitle());
            // 把数据集设置（复制）到剪贴板
            clipboard.setPrimaryClip(clipData);
            showToast("文字已复制");
        });

        LinearLayout black_list = dialog_share.findViewById(R.id.black_list);
        LinearLayout report = dialog_share.findViewById(R.id.report);
        LinearLayout delete = dialog_share.findViewById(R.id.delete);
        if (flag.equals("share")) {
            black_list.setVisibility(View.INVISIBLE);
            report.setVisibility(View.INVISIBLE);
        } else {
            if (mUserInfoBean != null) {
                if (mUserInfoBean.getUser().getUserId() == mContentDetailBean.getContent().getUserId()) {
                    black_list.setVisibility(View.INVISIBLE);
                    report.setVisibility(View.INVISIBLE);
                    delete.setVisibility(View.VISIBLE);
                } else {
                    black_list.setVisibility(View.VISIBLE);
                    report.setVisibility(View.VISIBLE);
                    delete.setVisibility(View.INVISIBLE);
                }
            }

            delete.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (Utils.isDoubleClick()) {
                        return;
                    }
                    DialogUtil.getInstance().dialog_bottom.dismiss();
                    showDialog(context, "删除中...");
                    HttpParams params = new HttpParams();
                    params.put("contentId", mContentDetailBean.getContent().getId());
                    finalOkGo.requestHead(RequestType.POSTHEAD, Url.DELETE_CONTENT, params, Url.DELETE_CONTENT, new Callback<SendCodeBean>() {
                        @Override
                        public void onSuccess(SendCodeBean sendCodeBean) {
                            dismissDialog();
                            if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                                EventBus.getDefault().post("refresh_home_data");
                                EventBus.getDefault().post("refresh_mine");
                                finishActivity();
                            } else {
                                if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                } else {
                                    showImageToas(sendCodeBean.getMsg());
                                }
                            }
                        }

                        @Override
                        public void onError(Response<String> response) {
                            super.onError(response);
                            dismissDialog();
                        }
                    });
                }
            });

            black_list.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (Utils.isDoubleClick()) {
                        return;
                    }
                    if (mContentDetailBean.getContent().getAnonymity() == 1) {
                        showImageToas("匿名用户不能屏蔽");
                    } else {
                        showDialog(context, "屏蔽中...");
                        finalOkGo.requestHead(RequestType.POSTHEAD, Url.ADD_BLACK_LIST + mContentDetailBean.getContent().getUserId(), null, Url.ADD_BLACK_LIST, new Callback<SendCodeBean>() {
                            @Override
                            public void onSuccess(SendCodeBean sendCodeBean) {
                                dismissDialog();
                                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
//                                    EventBus.getDefault().post("black_list:" + mContentDetailBean.getContent().getUserId());
                                    EventBus.getDefault().post("refresh_home_data");
                                    EventBus.getDefault().post("refresh_mine");
                                    finishActivity();
                                } else {
                                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                                    } else {
                                        showImageToas(sendCodeBean.getMsg());
                                    }
                                }
                            }

                            @Override
                            public void onError(Response<String> response) {
                                super.onError(response);
                                dismissDialog();
                            }
                        });
                    }

                }
            });
            report.setOnClickListener(view -> {
                if (Utils.isDoubleClick()) {
                    return;
                }
                Bundle bundle = new Bundle();
                bundle.putString("flag", "report");
                bundle.putString("contentId", mContentDetailBean.getContent().getId() + "");
                bundle.putString("module", "1");
                bundle.putString("type", "1");
                bundle.putString("byUserId", mContentDetailBean.getContent().getUserId() + "");
                startActivity(ReportActivity.class, bundle);
            });

        }

    }

    @Override
    public void onWbShareSuccess() {
//        showToast("分享成功");
//        shareSuccess();
    }

    @Override
    public void onWbShareCancel() {
//        showImageToas("分享取消");
    }

    @Override
    public void onWbShareFail() {
//        showImageToas("分享失败");
    }

    @Override
    public void callBack(BaseResp baseResp) {
        switch (baseResp.errCode) {
            case BaseResp.ErrCode.ERR_OK:
                showToast("分享成功");
                shareSuccess();
                break;
            case BaseResp.ErrCode.ERR_USER_CANCEL:
                showImageToas("分享取消");
                break;
            case BaseResp.ErrCode.ERR_AUTH_DENIED:
                showImageToas("分享被拒绝");
                break;
            default:
                showImageToas("分享返回");
                break;
        }
    }

    private void shareSuccess() {
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("contentId", mContentDetailBean.getContent().getId());
            jsonObject.put("module", 1);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        finalOkGo.requestHead(RequestType.POSTJSONHEAD, Url.SHARE_SUCCESS, null, jsonObject.toString(), new Callback<SendCodeBean>() {
            @Override
            public void onSuccess(SendCodeBean sendCodeBean) {
                if (sendCodeBean.getCode() == Contacts.SUCCESS) {
                } else {
                    if (sendCodeBean.getCode() == Contacts.TOKEN_EMPTY) {
                    } else {
                        showImageToas(sendCodeBean.getMsg());
                    }
                }
            }
        });
    }

    private class BaseUiListener implements IUiListener {

        @Override
        public void onComplete(Object o) {
//            showToast("分享成功");
//            shareSuccess();
        }

        @Override
        public void onError(UiError uiError) {
//            showImageToas("分享失败");
        }

        @Override
        public void onCancel() {
//            showImageToas("分享取消");
        }
    }

    private String share_flag = "";

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (share_flag.equals("weibo")) {
            shareHandler.doResultIntent(data, this);
        } else if (share_flag.equals("qq")) {
            if (mTencent != null) {
                mTencent.onActivityResult(requestCode, resultCode, data);
            }
        }
    }


    private TextObject getTextObj(String url, String title) {
        TextObject textObject = new TextObject();
        textObject.text = title + "\n" + url;
        textObject.title = title;
        textObject.actionUrl = url;
        return textObject;
    }
}
